@tsparticles/interaction-external-particle 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.
@@ -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.1
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,45 +28,25 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/InteractivityParticleMaker.js":
32
- /*!****************************************************!*\
33
- !*** ./dist/browser/InteractivityParticleMaker.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 */ InteractivityParticleMaker: () => (/* binding */ InteractivityParticleMaker)\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 _Options_Classes_InteractivityParticle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/InteractivityParticle.js */ \"./dist/browser/Options/Classes/InteractivityParticle.js\");\n\n\nconst particleMode = \"particle\";\nclass InteractivityParticleMaker extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n }\n clear() {}\n init() {}\n interact() {\n const container = this.container,\n {\n interactivity\n } = container,\n options = container.actualOptions;\n if (!container.retina.reduceFactor) {\n return;\n }\n const mousePos = interactivity.mouse.position,\n interactivityParticleOptions = options.interactivity.modes.particle;\n if (!interactivityParticleOptions) {\n return;\n }\n const mouseStopped = interactivityParticleOptions.pauseOnStop && (interactivity.mouse.position === this._lastPosition || interactivity.mouse.position?.x === this._lastPosition?.x && interactivity.mouse.position?.y === this._lastPosition?.y),\n clearDelay = interactivityParticleOptions.stopDelay;\n if (mousePos) {\n this._lastPosition = {\n ...mousePos\n };\n } else {\n delete this._lastPosition;\n }\n if (!this._lastPosition) {\n return;\n }\n if (mouseStopped) {\n if (this._clearTimeout) {\n return;\n }\n this._clearTimeout = setTimeout(() => {\n if (!this._particle) {\n return;\n }\n if (interactivityParticleOptions.replaceCursor) {\n const element = interactivity.element;\n if (element) {\n if (element instanceof Window) {\n document.body.style.cursor = \"\";\n } else {\n element.style.cursor = \"\";\n }\n }\n }\n this.container.particles.remove(this._particle, undefined, true);\n delete this._particle;\n }, clearDelay);\n return;\n }\n if (this._clearTimeout) {\n clearTimeout(this._clearTimeout);\n delete this._clearTimeout;\n }\n if (!this._particle) {\n const particleOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)(interactivityParticleOptions.options, {\n move: {\n enable: false\n }\n });\n this._particle = container.particles.addParticle(this._lastPosition, particleOptions);\n if (interactivityParticleOptions.replaceCursor) {\n const element = interactivity.element;\n if (element) {\n if (element instanceof Window) {\n document.body.style.cursor = \"none\";\n } else {\n element.style.cursor = \"none\";\n }\n }\n }\n }\n if (!this._particle) {\n return;\n }\n this._particle.position.x = this._lastPosition.x;\n this._particle.position.y = this._lastPosition.y;\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events;\n return mouse.clicking && mouse.inside && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(particleMode, events.onClick.mode) || mouse.inside && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(particleMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n if (!options.particle) {\n options.particle = new _Options_Classes_InteractivityParticle_js__WEBPACK_IMPORTED_MODULE_1__.InteractivityParticle();\n }\n for (const source of sources) {\n options.particle.load(source?.particle);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-particle/./dist/browser/InteractivityParticleMaker.js?\n}");
38
-
39
- /***/ }),
40
-
41
- /***/ "./dist/browser/Options/Classes/InteractivityParticle.js":
42
- /*!***************************************************************!*\
43
- !*** ./dist/browser/Options/Classes/InteractivityParticle.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 */ InteractivityParticle: () => (/* binding */ InteractivityParticle)\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\nclass InteractivityParticle {\n constructor() {\n this.replaceCursor = false;\n this.pauseOnStop = false;\n this.stopDelay = 0;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.options !== undefined) {\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, data.options);\n }\n if (data.replaceCursor !== undefined) {\n this.replaceCursor = data.replaceCursor;\n }\n if (data.pauseOnStop !== undefined) {\n this.pauseOnStop = data.pauseOnStop;\n }\n if (data.stopDelay !== undefined) {\n this.stopDelay = data.stopDelay;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-particle/./dist/browser/Options/Classes/InteractivityParticle.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 */ loadExternalParticleInteraction: () => (/* binding */ loadExternalParticleInteraction)\n/* harmony export */ });\n/* harmony import */ var _InteractivityParticleMaker_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./InteractivityParticleMaker.js */ \"./dist/browser/InteractivityParticleMaker.js\");\n\nasync function loadExternalParticleInteraction(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n await engine.addInteractor(\"externalParticle\", container => {\n return Promise.resolve(new _InteractivityParticleMaker_js__WEBPACK_IMPORTED_MODULE_0__.InteractivityParticleMaker(container));\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-particle/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadExternalParticleInteraction: () => (/* binding */ loadExternalParticleInteraction)\n/* harmony export */ });\nfunction loadExternalParticleInteraction(engine) {\n engine.checkVersion(\"4.0.0-alpha.1\");\n engine.register(e => {\n e.addInteractor(\"externalParticle\", async container => {\n const {\n InteractivityParticleMaker\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_InteractivityParticleMaker_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./InteractivityParticleMaker.js */ \"./dist/browser/InteractivityParticleMaker.js\"));\n return new InteractivityParticleMaker(container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-particle/./dist/browser/index.js?\n}");
58
38
 
59
- /***/ }),
39
+ /***/ },
60
40
 
61
- /***/ "@tsparticles/engine":
41
+ /***/ "@tsparticles/engine"
62
42
  /*!*********************************************************************************************************************************!*\
63
43
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
64
44
  \*********************************************************************************************************************************/
65
- /***/ ((module) => {
45
+ (module) {
66
46
 
67
47
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
68
48
 
69
- /***/ })
49
+ /***/ }
70
50
 
71
51
  /******/ });
72
52
  /************************************************************************/
@@ -80,6 +60,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
80
60
  /******/ if (cachedModule !== undefined) {
81
61
  /******/ return cachedModule.exports;
82
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
+ /******/ }
83
69
  /******/ // Create a new module (and put it into the cache)
84
70
  /******/ var module = __webpack_module_cache__[moduleId] = {
85
71
  /******/ // no module.id needed
@@ -94,19 +80,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
94
80
  /******/ return module.exports;
95
81
  /******/ }
96
82
  /******/
97
- /************************************************************************/
98
- /******/ /* webpack/runtime/compat get default export */
99
- /******/ (() => {
100
- /******/ // getDefaultExport function for compatibility with non-harmony modules
101
- /******/ __webpack_require__.n = (module) => {
102
- /******/ var getter = module && module.__esModule ?
103
- /******/ () => (module['default']) :
104
- /******/ () => (module);
105
- /******/ __webpack_require__.d(getter, { a: getter });
106
- /******/ return getter;
107
- /******/ };
108
- /******/ })();
83
+ /******/ // expose the modules object (__webpack_modules__)
84
+ /******/ __webpack_require__.m = __webpack_modules__;
109
85
  /******/
86
+ /************************************************************************/
110
87
  /******/ /* webpack/runtime/define property getters */
111
88
  /******/ (() => {
112
89
  /******/ // define getter functions for harmony exports
@@ -119,11 +96,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
119
96
  /******/ };
120
97
  /******/ })();
121
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
+ /******/
122
133
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
123
134
  /******/ (() => {
124
135
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
125
136
  /******/ })();
126
137
  /******/
138
+ /******/ /* webpack/runtime/load script */
139
+ /******/ (() => {
140
+ /******/ var inProgress = {};
141
+ /******/ var dataWebpackPrefix = "@tsparticles/interaction-external-particle:";
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
+ /******/
127
183
  /******/ /* webpack/runtime/make namespace object */
128
184
  /******/ (() => {
129
185
  /******/ // define __esModule on exports
@@ -135,6 +191,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
135
191
  /******/ };
136
192
  /******/ })();
137
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.interaction.external.particle": 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_interaction_external_particle"] = this["webpackChunk_tsparticles_interaction_external_particle"] || [];
303
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
304
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
305
+ /******/ })();
306
+ /******/
138
307
  /************************************************************************/
139
308
  /******/
140
309
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.interaction.external.particle.min.js.LICENSE.txt */
2
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},i={};function o(t){var s=i[t];if(void 0!==s)return s.exports;var r=i[t]={exports:{}};return e[t](r,r.exports,o),r.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{loadExternalParticleInteraction:()=>l});var r=o(303);class n{constructor(){this.replaceCursor=!1,this.pauseOnStop=!1,this.stopDelay=0}load(t){(0,r.isNull)(t)||(void 0!==t.options&&(this.options=(0,r.deepExtend)({},t.options)),void 0!==t.replaceCursor&&(this.replaceCursor=t.replaceCursor),void 0!==t.pauseOnStop&&(this.pauseOnStop=t.pauseOnStop),void 0!==t.stopDelay&&(this.stopDelay=t.stopDelay))}}const a="particle";class c extends r.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){}interact(){const t=this.container,{interactivity:e}=t,i=t.actualOptions;if(!t.retina.reduceFactor)return;const o=e.mouse.position,s=i.interactivity.modes.particle;if(!s)return;const n=s.pauseOnStop&&(e.mouse.position===this._lastPosition||e.mouse.position?.x===this._lastPosition?.x&&e.mouse.position?.y===this._lastPosition?.y),a=s.stopDelay;if(o?this._lastPosition={...o}:delete this._lastPosition,this._lastPosition)if(n){if(this._clearTimeout)return;this._clearTimeout=setTimeout((()=>{if(this._particle){if(s.replaceCursor){const t=e.element;t&&(t instanceof Window?document.body.style.cursor="":t.style.cursor="")}this.container.particles.remove(this._particle,void 0,!0),delete this._particle}}),a)}else{if(this._clearTimeout&&(clearTimeout(this._clearTimeout),delete this._clearTimeout),!this._particle){const i=(0,r.deepExtend)(s.options,{move:{enable:!1}});if(this._particle=t.particles.addParticle(this._lastPosition,i),s.replaceCursor){const t=e.element;t&&(t instanceof Window?document.body.style.cursor="none":t.style.cursor="none")}}this._particle&&(this._particle.position.x=this._lastPosition.x,this._particle.position.y=this._lastPosition.y)}}isEnabled(t){const e=this.container,i=e.actualOptions,o=e.interactivity.mouse,s=(t?.interactivity??i.interactivity).events;return o.clicking&&o.inside&&!!o.position&&(0,r.isInArray)(a,s.onClick.mode)||o.inside&&!!o.position&&(0,r.isInArray)(a,s.onHover.mode)}loadModeOptions(t,...e){t.particle||(t.particle=new n);for(const i of e)t.particle.load(i?.particle)}reset(){}}async function l(t,e=!0){t.checkVersion("3.9.1"),await t.addInteractor("externalParticle",(t=>Promise.resolve(new c(t))),e)}return s})()));
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 n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(e=>(()=>{var t,r,n={303(t){t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/interaction-external-particle:",i.l=(e,n,o,a)=>{if(t[e])t[e].push(n);else{var c,l;if(void 0!==o)for(var s=document.getElementsByTagName("script"),p=0;p<s.length;p++){var u=s[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+o){c=u;break}}c||(l=!0,(c=document.createElement("script")).charset="utf-8",i.nc&&c.setAttribute("nonce",i.nc),c.setAttribute("data-webpack",r+o),c.src=e),t[e]=[n];var d=(r,n)=>{c.onerror=c.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach((e=>e(n))),r)return r(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=d.bind(null,c.onerror),c.onload=d.bind(null,c.onload),l&&document.head.appendChild(c)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.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 n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={464:0};i.f.j=(t,r)=>{var n=i.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=o);var a=i.p+i.u(t),c=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",c.name="ChunkLoadError",c.type=o,c.request=a,n[1](c)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,o,[a,c,l]=r,s=0;if(a.some((t=>0!==e[t]))){for(n in c)i.o(c,n)&&(i.m[n]=c[n]);if(l)l(i)}for(t&&t(r);s<a.length;s++)o=a[s],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_interaction_external_particle=this.webpackChunk_tsparticles_interaction_external_particle||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function c(e){e.checkVersion("4.0.0-alpha.1"),e.register((e=>{e.addInteractor("externalParticle",(async e=>{const{InteractivityParticleMaker:t}=await i.e(302).then(i.bind(i,302));return new t(e)}))}))}return i.r(a),i.d(a,{loadExternalParticleInteraction:()=>c}),a})()));
@@ -1 +1 @@
1
- /*! tsParticles Particle External Interaction v3.9.1 by Matteo Bruni */
1
+ /*! tsParticles Particle External Interaction v4.0.0-alpha.1 by Matteo Bruni */
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadExternalParticleInteraction(engine: Engine, refresh?: boolean): Promise<void>;
2
+ export declare function loadExternalParticleInteraction(engine: Engine): void;
@@ -55,7 +55,7 @@
55
55
  const element = interactivity.element;
56
56
  if (element) {
57
57
  if (element instanceof Window) {
58
- document.body.style.cursor = "";
58
+ (0, engine_1.safeDocument)().body.style.cursor = "";
59
59
  }
60
60
  else {
61
61
  element.style.cursor = "";
@@ -82,7 +82,7 @@
82
82
  const element = interactivity.element;
83
83
  if (element) {
84
84
  if (element instanceof Window) {
85
- document.body.style.cursor = "none";
85
+ (0, engine_1.safeDocument)().body.style.cursor = "none";
86
86
  }
87
87
  else {
88
88
  element.style.cursor = "none";
@@ -102,9 +102,7 @@
102
102
  (mouse.inside && !!mouse.position && (0, engine_1.isInArray)(particleMode, events.onHover.mode)));
103
103
  }
104
104
  loadModeOptions(options, ...sources) {
105
- if (!options.particle) {
106
- options.particle = new InteractivityParticle_js_1.InteractivityParticle();
107
- }
105
+ options.particle ??= new InteractivityParticle_js_1.InteractivityParticle();
108
106
  for (const source of sources) {
109
107
  options.particle.load(source?.particle);
110
108
  }
package/umd/index.js CHANGED
@@ -1,20 +1,56 @@
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", "./InteractivityParticleMaker.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.loadExternalParticleInteraction = loadExternalParticleInteraction;
13
- const InteractivityParticleMaker_js_1 = require("./InteractivityParticleMaker.js");
14
- async function loadExternalParticleInteraction(engine, refresh = true) {
15
- engine.checkVersion("3.9.1");
16
- await engine.addInteractor("externalParticle", container => {
17
- return Promise.resolve(new InteractivityParticleMaker_js_1.InteractivityParticleMaker(container));
18
- }, refresh);
47
+ function loadExternalParticleInteraction(engine) {
48
+ engine.checkVersion("4.0.0-alpha.1");
49
+ engine.register(e => {
50
+ e.addInteractor("externalParticle", async (container) => {
51
+ const { InteractivityParticleMaker } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./InteractivityParticleMaker.js"))) : new Promise((resolve_1, reject_1) => { require(["./InteractivityParticleMaker.js"], resolve_1, reject_1); }).then(__importStar));
52
+ return new InteractivityParticleMaker(container);
53
+ });
54
+ });
19
55
  }
20
56
  });