@tsparticles/interaction-external-bubble 3.0.3 → 3.2.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,15 @@
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.0.3
7
+ * v3.2.0
8
+ */
9
+ /*
10
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
11
+ * This devtool is neither made for production nor for readable output files.
12
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
13
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
14
+ * or disable the default devtool with "devtool: false".
15
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8
16
  */
9
17
  (function webpackUniversalModuleDefinition(root, factory) {
10
18
  if(typeof exports === 'object' && typeof module === 'object')
@@ -15,15 +23,58 @@
15
23
  var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
16
24
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
25
  }
18
- })(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
26
+ })(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
19
27
  return /******/ (() => { // webpackBootstrap
20
28
  /******/ "use strict";
21
29
  /******/ var __webpack_modules__ = ({
22
30
 
23
- /***/ 533:
31
+ /***/ "./dist/browser/Options/Classes/Bubble.js":
32
+ /*!************************************************!*\
33
+ !*** ./dist/browser/Options/Classes/Bubble.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 */ Bubble: () => (/* binding */ Bubble)\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 _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n\n\n\nclass Bubble extends _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__.BubbleBase {\n load(data) {\n super.load(data);\n if (!data) {\n return;\n }\n this.divs = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.divs, div => {\n const tmp = new _BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__.BubbleDiv();\n tmp.load(div);\n return tmp;\n });\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Options/Classes/Bubble.js?");
38
+
39
+ /***/ }),
40
+
41
+ /***/ "./dist/browser/Options/Classes/BubbleBase.js":
42
+ /*!****************************************************!*\
43
+ !*** ./dist/browser/Options/Classes/BubbleBase.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 */ BubbleBase: () => (/* binding */ BubbleBase)\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 BubbleBase {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.mix = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.mix !== undefined) {\n this.mix = data.mix;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n if (data.color !== undefined) {\n const sourceColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(this.color) ? undefined : this.color;\n this.color = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.color, color => {\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(sourceColor, color);\n });\n }\n if (data.size !== undefined) {\n this.size = data.size;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Options/Classes/BubbleBase.js?");
48
+
49
+ /***/ }),
50
+
51
+ /***/ "./dist/browser/Options/Classes/BubbleDiv.js":
52
+ /*!***************************************************!*\
53
+ !*** ./dist/browser/Options/Classes/BubbleDiv.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 */ BubbleDiv: () => (/* binding */ BubbleDiv)\n/* harmony export */ });\n/* harmony import */ var _BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n\nclass BubbleDiv extends _BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__.BubbleBase {\n constructor() {\n super();\n this.selectors = [];\n }\n load(data) {\n super.load(data);\n if (!data) {\n return;\n }\n if (data.selectors !== undefined) {\n this.selectors = data.selectors;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Options/Classes/BubbleDiv.js?");
58
+
59
+ /***/ }),
60
+
61
+ /***/ "./dist/browser/index.js":
62
+ /*!*******************************!*\
63
+ !*** ./dist/browser/index.js ***!
64
+ \*******************************/
65
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
66
+
67
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* reexport safe */ _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__.Bubble),\n/* harmony export */ BubbleBase: () => (/* reexport safe */ _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__.BubbleBase),\n/* harmony export */ BubbleDiv: () => (/* reexport safe */ _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_1__.BubbleDiv),\n/* harmony export */ loadExternalBubbleInteraction: () => (/* binding */ loadExternalBubbleInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\nasync function loadExternalBubbleInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalBubble\", async container => {\n const {\n Bubbler\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Bubbler_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Bubbler.js */ \"./dist/browser/Bubbler.js\"));\n return new Bubbler(container);\n }, refresh);\n}\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/index.js?");
68
+
69
+ /***/ }),
70
+
71
+ /***/ "@tsparticles/engine":
72
+ /*!*********************************************************************************************************************************!*\
73
+ !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
74
+ \*********************************************************************************************************************************/
24
75
  /***/ ((module) => {
25
76
 
26
- module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
77
+ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
27
78
 
28
79
  /***/ })
29
80
 
@@ -53,7 +104,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
53
104
  /******/ return module.exports;
54
105
  /******/ }
55
106
  /******/
107
+ /******/ // expose the modules object (__webpack_modules__)
108
+ /******/ __webpack_require__.m = __webpack_modules__;
109
+ /******/
56
110
  /************************************************************************/
111
+ /******/ /* webpack/runtime/compat get default export */
112
+ /******/ (() => {
113
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
114
+ /******/ __webpack_require__.n = (module) => {
115
+ /******/ var getter = module && module.__esModule ?
116
+ /******/ () => (module['default']) :
117
+ /******/ () => (module);
118
+ /******/ __webpack_require__.d(getter, { a: getter });
119
+ /******/ return getter;
120
+ /******/ };
121
+ /******/ })();
122
+ /******/
57
123
  /******/ /* webpack/runtime/define property getters */
58
124
  /******/ (() => {
59
125
  /******/ // define getter functions for harmony exports
@@ -66,11 +132,91 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
66
132
  /******/ };
67
133
  /******/ })();
68
134
  /******/
135
+ /******/ /* webpack/runtime/ensure chunk */
136
+ /******/ (() => {
137
+ /******/ __webpack_require__.f = {};
138
+ /******/ // This file contains only the entry chunk.
139
+ /******/ // The chunk loading function for additional chunks
140
+ /******/ __webpack_require__.e = (chunkId) => {
141
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
142
+ /******/ __webpack_require__.f[key](chunkId, promises);
143
+ /******/ return promises;
144
+ /******/ }, []));
145
+ /******/ };
146
+ /******/ })();
147
+ /******/
148
+ /******/ /* webpack/runtime/get javascript chunk filename */
149
+ /******/ (() => {
150
+ /******/ // This function allow to reference async chunks
151
+ /******/ __webpack_require__.u = (chunkId) => {
152
+ /******/ // return url for filenames based on template
153
+ /******/ return "" + chunkId + ".js";
154
+ /******/ };
155
+ /******/ })();
156
+ /******/
157
+ /******/ /* webpack/runtime/global */
158
+ /******/ (() => {
159
+ /******/ __webpack_require__.g = (function() {
160
+ /******/ if (typeof globalThis === 'object') return globalThis;
161
+ /******/ try {
162
+ /******/ return this || new Function('return this')();
163
+ /******/ } catch (e) {
164
+ /******/ if (typeof window === 'object') return window;
165
+ /******/ }
166
+ /******/ })();
167
+ /******/ })();
168
+ /******/
69
169
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
70
170
  /******/ (() => {
71
171
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
72
172
  /******/ })();
73
173
  /******/
174
+ /******/ /* webpack/runtime/load script */
175
+ /******/ (() => {
176
+ /******/ var inProgress = {};
177
+ /******/ var dataWebpackPrefix = "@tsparticles/interaction-external-bubble:";
178
+ /******/ // loadScript function to load a script via script tag
179
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
180
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
181
+ /******/ var script, needAttach;
182
+ /******/ if(key !== undefined) {
183
+ /******/ var scripts = document.getElementsByTagName("script");
184
+ /******/ for(var i = 0; i < scripts.length; i++) {
185
+ /******/ var s = scripts[i];
186
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
187
+ /******/ }
188
+ /******/ }
189
+ /******/ if(!script) {
190
+ /******/ needAttach = true;
191
+ /******/ script = document.createElement('script');
192
+ /******/
193
+ /******/ script.charset = 'utf-8';
194
+ /******/ script.timeout = 120;
195
+ /******/ if (__webpack_require__.nc) {
196
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
197
+ /******/ }
198
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
199
+ /******/
200
+ /******/ script.src = url;
201
+ /******/ }
202
+ /******/ inProgress[url] = [done];
203
+ /******/ var onScriptComplete = (prev, event) => {
204
+ /******/ // avoid mem leaks in IE.
205
+ /******/ script.onerror = script.onload = null;
206
+ /******/ clearTimeout(timeout);
207
+ /******/ var doneFns = inProgress[url];
208
+ /******/ delete inProgress[url];
209
+ /******/ script.parentNode && script.parentNode.removeChild(script);
210
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
211
+ /******/ if(prev) return prev(event);
212
+ /******/ }
213
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
214
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
215
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
216
+ /******/ needAttach && document.head.appendChild(script);
217
+ /******/ };
218
+ /******/ })();
219
+ /******/
74
220
  /******/ /* webpack/runtime/make namespace object */
75
221
  /******/ (() => {
76
222
  /******/ // define __esModule on exports
@@ -82,432 +228,128 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
82
228
  /******/ };
83
229
  /******/ })();
84
230
  /******/
231
+ /******/ /* webpack/runtime/publicPath */
232
+ /******/ (() => {
233
+ /******/ var scriptUrl;
234
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
235
+ /******/ var document = __webpack_require__.g.document;
236
+ /******/ if (!scriptUrl && document) {
237
+ /******/ if (document.currentScript)
238
+ /******/ scriptUrl = document.currentScript.src;
239
+ /******/ if (!scriptUrl) {
240
+ /******/ var scripts = document.getElementsByTagName("script");
241
+ /******/ if(scripts.length) {
242
+ /******/ var i = scripts.length - 1;
243
+ /******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
244
+ /******/ }
245
+ /******/ }
246
+ /******/ }
247
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
248
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
249
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
250
+ /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
251
+ /******/ __webpack_require__.p = scriptUrl;
252
+ /******/ })();
253
+ /******/
254
+ /******/ /* webpack/runtime/jsonp chunk loading */
255
+ /******/ (() => {
256
+ /******/ // no baseURI
257
+ /******/
258
+ /******/ // object to store loaded and loading chunks
259
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
260
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
261
+ /******/ var installedChunks = {
262
+ /******/ "tsparticles.interaction.external.bubble": 0
263
+ /******/ };
264
+ /******/
265
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
266
+ /******/ // JSONP chunk loading for javascript
267
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
268
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
269
+ /******/
270
+ /******/ // a Promise means "currently loading".
271
+ /******/ if(installedChunkData) {
272
+ /******/ promises.push(installedChunkData[2]);
273
+ /******/ } else {
274
+ /******/ if(true) { // all chunks have JS
275
+ /******/ // setup Promise in chunk cache
276
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
277
+ /******/ promises.push(installedChunkData[2] = promise);
278
+ /******/
279
+ /******/ // start chunk loading
280
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
281
+ /******/ // create error before stack unwound to get useful stacktrace later
282
+ /******/ var error = new Error();
283
+ /******/ var loadingEnded = (event) => {
284
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
285
+ /******/ installedChunkData = installedChunks[chunkId];
286
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
287
+ /******/ if(installedChunkData) {
288
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
289
+ /******/ var realSrc = event && event.target && event.target.src;
290
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
291
+ /******/ error.name = 'ChunkLoadError';
292
+ /******/ error.type = errorType;
293
+ /******/ error.request = realSrc;
294
+ /******/ installedChunkData[1](error);
295
+ /******/ }
296
+ /******/ }
297
+ /******/ };
298
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
299
+ /******/ }
300
+ /******/ }
301
+ /******/ }
302
+ /******/ };
303
+ /******/
304
+ /******/ // no prefetching
305
+ /******/
306
+ /******/ // no preloaded
307
+ /******/
308
+ /******/ // no HMR
309
+ /******/
310
+ /******/ // no HMR manifest
311
+ /******/
312
+ /******/ // no on chunks loaded
313
+ /******/
314
+ /******/ // install a JSONP callback for chunk loading
315
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
316
+ /******/ var chunkIds = data[0];
317
+ /******/ var moreModules = data[1];
318
+ /******/ var runtime = data[2];
319
+ /******/ // add "moreModules" to the modules object,
320
+ /******/ // then flag all "chunkIds" as loaded and fire callback
321
+ /******/ var moduleId, chunkId, i = 0;
322
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
323
+ /******/ for(moduleId in moreModules) {
324
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
325
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
326
+ /******/ }
327
+ /******/ }
328
+ /******/ if(runtime) var result = runtime(__webpack_require__);
329
+ /******/ }
330
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
331
+ /******/ for(;i < chunkIds.length; i++) {
332
+ /******/ chunkId = chunkIds[i];
333
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
334
+ /******/ installedChunks[chunkId][0]();
335
+ /******/ }
336
+ /******/ installedChunks[chunkId] = 0;
337
+ /******/ }
338
+ /******/
339
+ /******/ }
340
+ /******/
341
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_bubble"] = this["webpackChunk_tsparticles_interaction_external_bubble"] || [];
342
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
343
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
344
+ /******/ })();
345
+ /******/
85
346
  /************************************************************************/
86
- var __webpack_exports__ = {};
87
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
88
- (() => {
89
- // ESM COMPAT FLAG
90
- __webpack_require__.r(__webpack_exports__);
91
-
92
- // EXPORTS
93
- __webpack_require__.d(__webpack_exports__, {
94
- Bubble: () => (/* reexport */ Bubble),
95
- BubbleBase: () => (/* reexport */ BubbleBase),
96
- BubbleDiv: () => (/* reexport */ BubbleDiv),
97
- loadExternalBubbleInteraction: () => (/* binding */ loadExternalBubbleInteraction)
98
- });
99
-
100
- // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
101
- var engine_root_window_ = __webpack_require__(533);
102
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/BubbleBase.js
103
-
104
- class BubbleBase {
105
- constructor() {
106
- this.distance = 200;
107
- this.duration = 0.4;
108
- this.mix = false;
109
- }
110
- load(data) {
111
- if (!data) {
112
- return;
113
- }
114
- if (data.distance !== undefined) {
115
- this.distance = data.distance;
116
- }
117
- if (data.duration !== undefined) {
118
- this.duration = data.duration;
119
- }
120
- if (data.mix !== undefined) {
121
- this.mix = data.mix;
122
- }
123
- if (data.opacity !== undefined) {
124
- this.opacity = data.opacity;
125
- }
126
- if (data.color !== undefined) {
127
- const sourceColor = (0,engine_root_window_.isArray)(this.color) ? undefined : this.color;
128
- this.color = (0,engine_root_window_.executeOnSingleOrMultiple)(data.color, color => {
129
- return engine_root_window_.OptionsColor.create(sourceColor, color);
130
- });
131
- }
132
- if (data.size !== undefined) {
133
- this.size = data.size;
134
- }
135
- }
136
- }
137
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/BubbleDiv.js
138
-
139
- class BubbleDiv extends BubbleBase {
140
- constructor() {
141
- super();
142
- this.selectors = [];
143
- }
144
- load(data) {
145
- super.load(data);
146
- if (!data) {
147
- return;
148
- }
149
- if (data.selectors !== undefined) {
150
- this.selectors = data.selectors;
151
- }
152
- }
153
- }
154
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Bubble.js
155
-
156
-
157
-
158
- class Bubble extends BubbleBase {
159
- load(data) {
160
- super.load(data);
161
- if (!data) {
162
- return;
163
- }
164
- this.divs = (0,engine_root_window_.executeOnSingleOrMultiple)(data.divs, div => {
165
- const tmp = new BubbleDiv();
166
- tmp.load(div);
167
- return tmp;
168
- });
169
- }
170
- }
171
- ;// CONCATENATED MODULE: ./dist/browser/Utils.js
172
-
173
- function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
174
- if (modeValue >= optionsValue) {
175
- const value = particleValue + (modeValue - optionsValue) * ratio;
176
- return (0,engine_root_window_.clamp)(value, particleValue, modeValue);
177
- } else if (modeValue < optionsValue) {
178
- const value = particleValue - (optionsValue - modeValue) * ratio;
179
- return (0,engine_root_window_.clamp)(value, modeValue, particleValue);
180
- }
181
- }
182
- ;// CONCATENATED MODULE: ./dist/browser/Bubbler.js
183
-
184
-
185
-
186
- const bubbleMode = "bubble";
187
- class Bubbler extends engine_root_window_.ExternalInteractorBase {
188
- constructor(container) {
189
- super(container);
190
- this._clickBubble = () => {
191
- const container = this.container,
192
- options = container.actualOptions,
193
- mouseClickPos = container.interactivity.mouse.clickPosition,
194
- bubbleOptions = options.interactivity.modes.bubble;
195
- if (!bubbleOptions || !mouseClickPos) {
196
- return;
197
- }
198
- if (!container.bubble) {
199
- container.bubble = {};
200
- }
201
- const distance = container.retina.bubbleModeDistance;
202
- if (!distance || distance < 0) {
203
- return;
204
- }
205
- const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)),
206
- {
207
- bubble
208
- } = container;
209
- for (const particle of query) {
210
- if (!bubble.clicking) {
211
- continue;
212
- }
213
- particle.bubble.inRange = !bubble.durationEnd;
214
- const pos = particle.getPosition(),
215
- distMouse = (0,engine_root_window_.getDistance)(pos, mouseClickPos),
216
- timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000;
217
- if (timeSpent > bubbleOptions.duration) {
218
- bubble.durationEnd = true;
219
- }
220
- if (timeSpent > bubbleOptions.duration * 2) {
221
- bubble.clicking = false;
222
- bubble.durationEnd = false;
223
- }
224
- const sizeData = {
225
- bubbleObj: {
226
- optValue: container.retina.bubbleModeSize,
227
- value: particle.bubble.radius
228
- },
229
- particlesObj: {
230
- optValue: (0,engine_root_window_.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
231
- value: particle.size.value
232
- },
233
- type: "size"
234
- };
235
- this._process(particle, distMouse, timeSpent, sizeData);
236
- const opacityData = {
237
- bubbleObj: {
238
- optValue: bubbleOptions.opacity,
239
- value: particle.bubble.opacity
240
- },
241
- particlesObj: {
242
- optValue: (0,engine_root_window_.getRangeMax)(particle.options.opacity.value),
243
- value: particle.opacity?.value ?? 1
244
- },
245
- type: "opacity"
246
- };
247
- this._process(particle, distMouse, timeSpent, opacityData);
248
- if (!bubble.durationEnd && distMouse <= distance) {
249
- this._hoverBubbleColor(particle, distMouse);
250
- } else {
251
- delete particle.bubble.color;
252
- }
253
- }
254
- };
255
- this._hoverBubble = () => {
256
- const container = this.container,
257
- mousePos = container.interactivity.mouse.position,
258
- distance = container.retina.bubbleModeDistance;
259
- if (!distance || distance < 0 || mousePos === undefined) {
260
- return;
261
- }
262
- const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
263
- for (const particle of query) {
264
- particle.bubble.inRange = true;
265
- const pos = particle.getPosition(),
266
- pointDistance = (0,engine_root_window_.getDistance)(pos, mousePos),
267
- ratio = 1 - pointDistance / distance;
268
- if (pointDistance <= distance) {
269
- if (ratio >= 0 && container.interactivity.status === engine_root_window_.mouseMoveEvent) {
270
- this._hoverBubbleSize(particle, ratio);
271
- this._hoverBubbleOpacity(particle, ratio);
272
- this._hoverBubbleColor(particle, ratio);
273
- }
274
- } else {
275
- this.reset(particle);
276
- }
277
- if (container.interactivity.status === engine_root_window_.mouseLeaveEvent) {
278
- this.reset(particle);
279
- }
280
- }
281
- };
282
- this._hoverBubbleColor = (particle, ratio, divBubble) => {
283
- const options = this.container.actualOptions,
284
- bubbleOptions = divBubble ?? options.interactivity.modes.bubble;
285
- if (!bubbleOptions) {
286
- return;
287
- }
288
- if (!particle.bubble.finalColor) {
289
- const modeColor = bubbleOptions.color;
290
- if (!modeColor) {
291
- return;
292
- }
293
- const bubbleColor = (0,engine_root_window_.itemFromSingleOrMultiple)(modeColor);
294
- particle.bubble.finalColor = (0,engine_root_window_.rangeColorToHsl)(bubbleColor);
295
- }
296
- if (!particle.bubble.finalColor) {
297
- return;
298
- }
299
- if (bubbleOptions.mix) {
300
- particle.bubble.color = undefined;
301
- const pColor = particle.getFillColor();
302
- particle.bubble.color = pColor ? (0,engine_root_window_.rgbToHsl)((0,engine_root_window_.colorMix)(pColor, particle.bubble.finalColor, 1 - ratio, ratio)) : particle.bubble.finalColor;
303
- } else {
304
- particle.bubble.color = particle.bubble.finalColor;
305
- }
306
- };
307
- this._hoverBubbleOpacity = (particle, ratio, divBubble) => {
308
- const container = this.container,
309
- options = container.actualOptions,
310
- modeOpacity = divBubble?.opacity ?? options.interactivity.modes.bubble?.opacity;
311
- if (!modeOpacity) {
312
- return;
313
- }
314
- const optOpacity = particle.options.opacity.value,
315
- pOpacity = particle.opacity?.value ?? 1,
316
- opacity = calculateBubbleValue(pOpacity, modeOpacity, (0,engine_root_window_.getRangeMax)(optOpacity), ratio);
317
- if (opacity !== undefined) {
318
- particle.bubble.opacity = opacity;
319
- }
320
- };
321
- this._hoverBubbleSize = (particle, ratio, divBubble) => {
322
- const container = this.container,
323
- modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
324
- if (modeSize === undefined) {
325
- return;
326
- }
327
- const optSize = (0,engine_root_window_.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
328
- pSize = particle.size.value,
329
- size = calculateBubbleValue(pSize, modeSize, optSize, ratio);
330
- if (size !== undefined) {
331
- particle.bubble.radius = size;
332
- }
333
- };
334
- this._process = (particle, distMouse, timeSpent, data) => {
335
- const container = this.container,
336
- bubbleParam = data.bubbleObj.optValue,
337
- options = container.actualOptions,
338
- bubbleOptions = options.interactivity.modes.bubble;
339
- if (!bubbleOptions || bubbleParam === undefined) {
340
- return;
341
- }
342
- const bubbleDuration = bubbleOptions.duration,
343
- bubbleDistance = container.retina.bubbleModeDistance,
344
- particlesParam = data.particlesObj.optValue,
345
- pObjBubble = data.bubbleObj.value,
346
- pObj = data.particlesObj.value || 0,
347
- type = data.type;
348
- if (!bubbleDistance || bubbleDistance < 0 || bubbleParam === particlesParam) {
349
- return;
350
- }
351
- if (!container.bubble) {
352
- container.bubble = {};
353
- }
354
- if (container.bubble.durationEnd) {
355
- if (pObjBubble) {
356
- if (type === "size") {
357
- delete particle.bubble.radius;
358
- }
359
- if (type === "opacity") {
360
- delete particle.bubble.opacity;
361
- }
362
- }
363
- } else {
364
- if (distMouse <= bubbleDistance) {
365
- const obj = pObjBubble ?? pObj;
366
- if (obj !== bubbleParam) {
367
- const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;
368
- if (type === "size") {
369
- particle.bubble.radius = value;
370
- }
371
- if (type === "opacity") {
372
- particle.bubble.opacity = value;
373
- }
374
- }
375
- } else {
376
- if (type === "size") {
377
- delete particle.bubble.radius;
378
- }
379
- if (type === "opacity") {
380
- delete particle.bubble.opacity;
381
- }
382
- }
383
- }
384
- };
385
- this._singleSelectorHover = (delta, selector, div) => {
386
- const container = this.container,
387
- selectors = document.querySelectorAll(selector),
388
- bubble = container.actualOptions.interactivity.modes.bubble;
389
- if (!bubble || !selectors.length) {
390
- return;
391
- }
392
- selectors.forEach(item => {
393
- const elem = item,
394
- pxRatio = container.retina.pixelRatio,
395
- pos = {
396
- x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
397
- y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
398
- },
399
- repulseRadius = elem.offsetWidth / 2 * pxRatio,
400
- area = div.type === "circle" ? new engine_root_window_.Circle(pos.x, pos.y, repulseRadius) : new engine_root_window_.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),
401
- query = container.particles.quadTree.query(area, p => this.isEnabled(p));
402
- for (const particle of query) {
403
- if (!area.contains(particle.getPosition())) {
404
- continue;
405
- }
406
- particle.bubble.inRange = true;
407
- const divs = bubble.divs,
408
- divBubble = (0,engine_root_window_.divMode)(divs, elem);
409
- if (!particle.bubble.div || particle.bubble.div !== elem) {
410
- this.clear(particle, delta, true);
411
- particle.bubble.div = elem;
412
- }
413
- this._hoverBubbleSize(particle, 1, divBubble);
414
- this._hoverBubbleOpacity(particle, 1, divBubble);
415
- this._hoverBubbleColor(particle, 1, divBubble);
416
- }
417
- });
418
- };
419
- if (!container.bubble) {
420
- container.bubble = {};
421
- }
422
- this.handleClickMode = mode => {
423
- if (mode !== bubbleMode) {
424
- return;
425
- }
426
- if (!container.bubble) {
427
- container.bubble = {};
428
- }
429
- container.bubble.clicking = true;
430
- };
431
- }
432
- clear(particle, delta, force) {
433
- if (particle.bubble.inRange && !force) {
434
- return;
435
- }
436
- delete particle.bubble.div;
437
- delete particle.bubble.opacity;
438
- delete particle.bubble.radius;
439
- delete particle.bubble.color;
440
- }
441
- init() {
442
- const container = this.container,
443
- bubble = container.actualOptions.interactivity.modes.bubble;
444
- if (!bubble) {
445
- return;
446
- }
447
- container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;
448
- if (bubble.size !== undefined) {
449
- container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
450
- }
451
- }
452
- async interact(delta) {
453
- const options = this.container.actualOptions,
454
- events = options.interactivity.events,
455
- onHover = events.onHover,
456
- onClick = events.onClick,
457
- hoverEnabled = onHover.enable,
458
- hoverMode = onHover.mode,
459
- clickEnabled = onClick.enable,
460
- clickMode = onClick.mode,
461
- divs = events.onDiv;
462
- if (hoverEnabled && (0,engine_root_window_.isInArray)(bubbleMode, hoverMode)) {
463
- this._hoverBubble();
464
- } else if (clickEnabled && (0,engine_root_window_.isInArray)(bubbleMode, clickMode)) {
465
- this._clickBubble();
466
- } else {
467
- (0,engine_root_window_.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
468
- }
469
- }
470
- isEnabled(particle) {
471
- const container = this.container,
472
- options = container.actualOptions,
473
- mouse = container.interactivity.mouse,
474
- events = (particle?.interactivity ?? options.interactivity).events,
475
- {
476
- onClick,
477
- onDiv,
478
- onHover
479
- } = events,
480
- divBubble = (0,engine_root_window_.isDivModeEnabled)(bubbleMode, onDiv);
481
- if (!(divBubble || onHover.enable && mouse.position || onClick.enable && mouse.clickPosition)) {
482
- return false;
483
- }
484
- return (0,engine_root_window_.isInArray)(bubbleMode, onHover.mode) || (0,engine_root_window_.isInArray)(bubbleMode, onClick.mode) || divBubble;
485
- }
486
- loadModeOptions(options, ...sources) {
487
- if (!options.bubble) {
488
- options.bubble = new Bubble();
489
- }
490
- for (const source of sources) {
491
- options.bubble.load(source?.bubble);
492
- }
493
- }
494
- reset(particle) {
495
- particle.bubble.inRange = false;
496
- }
497
- }
498
- ;// CONCATENATED MODULE: ./dist/browser/index.js
499
-
500
- async function loadExternalBubbleInteraction(engine, refresh = true) {
501
- await engine.addInteractor("externalBubble", container => new Bubbler(container), refresh);
502
- }
503
-
504
-
505
-
506
-
507
-
508
-
509
- })();
510
-
347
+ /******/
348
+ /******/ // startup
349
+ /******/ // Load entry module and return exports
350
+ /******/ // This entry module can't be inlined because the eval devtool is used.
351
+ /******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
352
+ /******/
511
353
  /******/ return __webpack_exports__;
512
354
  /******/ })()
513
355
  ;