@tsparticles/updater-destroy 3.9.1 → 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.1
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,105 +28,25 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/DestroyUpdater.js":
32
- /*!****************************************!*\
33
- !*** ./dist/browser/DestroyUpdater.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 */ DestroyUpdater: () => (/* binding */ DestroyUpdater)\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_Destroy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Destroy.js */ \"./dist/browser/Options/Classes/Destroy.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nclass DestroyUpdater {\n constructor(engine, container) {\n this.container = container;\n this.engine = engine;\n }\n init(particle) {\n const container = this.container,\n particlesOptions = particle.options,\n destroyOptions = particlesOptions.destroy;\n if (!destroyOptions) {\n return;\n }\n particle.splitCount = 0;\n const destroyBoundsOptions = destroyOptions.bounds;\n if (!particle.destroyBounds) {\n particle.destroyBounds = {};\n }\n const {\n bottom,\n left,\n right,\n top\n } = destroyBoundsOptions,\n {\n destroyBounds\n } = particle,\n canvasSize = container.canvas.size;\n if (bottom) {\n destroyBounds.bottom = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(bottom) * canvasSize.height / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (left) {\n destroyBounds.left = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(left) * canvasSize.width / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (right) {\n destroyBounds.right = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(right) * canvasSize.width / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (top) {\n destroyBounds.top = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(top) * canvasSize.height / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n }\n isEnabled(particle) {\n return !particle.destroyed;\n }\n loadOptions(options, ...sources) {\n if (!options.destroy) {\n options.destroy = new _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__.Destroy();\n }\n for (const source of sources) {\n options.destroy.load(source?.destroy);\n }\n }\n particleDestroyed(particle, override) {\n if (override) {\n return;\n }\n const destroyOptions = particle.options.destroy;\n if (destroyOptions && destroyOptions.mode === _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyMode.split) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__.split)(this.engine, this.container, particle);\n }\n }\n update(particle) {\n if (!this.isEnabled(particle)) {\n return;\n }\n const position = particle.getPosition(),\n bounds = particle.destroyBounds;\n if (!bounds) {\n return;\n }\n if (bounds.bottom !== undefined && position.y >= bounds.bottom || bounds.left !== undefined && position.x <= bounds.left || bounds.right !== undefined && position.x >= bounds.right || bounds.top !== undefined && position.y <= bounds.top) {\n particle.destroy();\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/DestroyUpdater.js?\n}");
38
-
39
- /***/ }),
40
-
41
- /***/ "./dist/browser/Enums/DestroyMode.js":
42
- /*!*******************************************!*\
43
- !*** ./dist/browser/Enums/DestroyMode.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 */ DestroyMode: () => (/* binding */ DestroyMode)\n/* harmony export */ });\nvar DestroyMode;\n(function (DestroyMode) {\n DestroyMode[\"none\"] = \"none\";\n DestroyMode[\"split\"] = \"split\";\n})(DestroyMode || (DestroyMode = {}));\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Enums/DestroyMode.js?\n}");
48
-
49
- /***/ }),
50
-
51
- /***/ "./dist/browser/Options/Classes/Destroy.js":
52
- /*!*************************************************!*\
53
- !*** ./dist/browser/Options/Classes/Destroy.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 */ Destroy: () => (/* binding */ Destroy)\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 _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DestroyBounds.js */ \"./dist/browser/Options/Classes/DestroyBounds.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Split_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Split.js */ \"./dist/browser/Options/Classes/Split.js\");\n\n\n\n\nclass Destroy {\n constructor() {\n this.bounds = new _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__.DestroyBounds();\n this.mode = _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyMode.none;\n this.split = new _Split_js__WEBPACK_IMPORTED_MODULE_3__.Split();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.mode) {\n this.mode = data.mode;\n }\n if (data.bounds) {\n this.bounds.load(data.bounds);\n }\n this.split.load(data.split);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Destroy.js?\n}");
58
-
59
- /***/ }),
60
-
61
- /***/ "./dist/browser/Options/Classes/DestroyBounds.js":
62
- /*!*******************************************************!*\
63
- !*** ./dist/browser/Options/Classes/DestroyBounds.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 */ DestroyBounds: () => (/* binding */ DestroyBounds)\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 DestroyBounds {\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.bottom !== undefined) {\n this.bottom = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.bottom);\n }\n if (data.left !== undefined) {\n this.left = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.left);\n }\n if (data.right !== undefined) {\n this.right = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.right);\n }\n if (data.top !== undefined) {\n this.top = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.top);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/DestroyBounds.js?\n}");
68
-
69
- /***/ }),
70
-
71
- /***/ "./dist/browser/Options/Classes/Split.js":
72
- /*!***********************************************!*\
73
- !*** ./dist/browser/Options/Classes/Split.js ***!
74
- \***********************************************/
75
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
76
-
77
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Split: () => (/* binding */ Split)\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 _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SplitFactor.js */ \"./dist/browser/Options/Classes/SplitFactor.js\");\n/* harmony import */ var _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SplitRate.js */ \"./dist/browser/Options/Classes/SplitRate.js\");\n\n\n\nclass Split {\n constructor() {\n this.count = 1;\n this.factor = new _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__.SplitFactor();\n this.rate = new _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__.SplitRate();\n this.sizeOffset = true;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.color !== undefined) {\n this.color = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.color, data.color);\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n this.factor.load(data.factor);\n this.rate.load(data.rate);\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.particles, particles => {\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, particles);\n });\n if (data.sizeOffset !== undefined) {\n this.sizeOffset = data.sizeOffset;\n }\n if (data.colorOffset) {\n this.colorOffset = this.colorOffset ?? {};\n if (data.colorOffset.h !== undefined) {\n this.colorOffset.h = data.colorOffset.h;\n }\n if (data.colorOffset.s !== undefined) {\n this.colorOffset.s = data.colorOffset.s;\n }\n if (data.colorOffset.l !== undefined) {\n this.colorOffset.l = data.colorOffset.l;\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Split.js?\n}");
78
-
79
- /***/ }),
80
-
81
- /***/ "./dist/browser/Options/Classes/SplitFactor.js":
82
- /*!*****************************************************!*\
83
- !*** ./dist/browser/Options/Classes/SplitFactor.js ***!
84
- \*****************************************************/
85
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
86
-
87
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitFactor: () => (/* binding */ SplitFactor)\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 SplitFactor extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor() {\n super();\n this.value = 3;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/SplitFactor.js?\n}");
88
-
89
- /***/ }),
90
-
91
- /***/ "./dist/browser/Options/Classes/SplitRate.js":
92
- /*!***************************************************!*\
93
- !*** ./dist/browser/Options/Classes/SplitRate.js ***!
94
- \***************************************************/
95
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
96
-
97
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitRate: () => (/* binding */ SplitRate)\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 SplitRate extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor() {\n super();\n this.value = {\n min: 4,\n max: 9\n };\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/SplitRate.js?\n}");
98
-
99
- /***/ }),
100
-
101
- /***/ "./dist/browser/Utils.js":
102
- /*!*******************************!*\
103
- !*** ./dist/browser/Utils.js ***!
104
- \*******************************/
105
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
106
-
107
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ split: () => (/* binding */ split)\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\nconst defaultOffset = 0,\n minDestroySize = 0.5,\n defaultSplitCount = 0,\n increment = 1,\n unbreakableTime = 500,\n minSplitCount = 0;\nfunction addSplitParticle(engine, container, parent, splitParticlesOptions) {\n const destroyOptions = parent.options.destroy;\n if (!destroyOptions) {\n return;\n }\n const splitOptions = destroyOptions.split,\n options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.loadParticlesOptions)(engine, container, parent.options),\n factor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.factor.value),\n parentColor = parent.getFillColor();\n if (splitOptions.color) {\n options.color.load(splitOptions.color);\n } else if (splitOptions.colorOffset && parentColor) {\n options.color.load({\n value: {\n hsl: {\n h: parentColor.h + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.colorOffset.h ?? defaultOffset),\n s: parentColor.s + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.colorOffset.s ?? defaultOffset),\n l: parentColor.l + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.colorOffset.l ?? defaultOffset)\n }\n }\n });\n } else {\n options.color.load({\n value: {\n hsl: parent.getFillColor()\n }\n });\n }\n options.move.load({\n center: {\n x: parent.position.x,\n y: parent.position.y,\n mode: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.PixelMode.precise\n }\n });\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(options.size.value)) {\n options.size.value /= factor;\n } else {\n options.size.value.min /= factor;\n options.size.value.max /= factor;\n }\n options.load(splitParticlesOptions);\n const offset = splitOptions.sizeOffset ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset,\n position = {\n x: parent.position.x + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(offset),\n y: parent.position.y + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(offset)\n };\n return container.particles.addParticle(position, options, parent.group, particle => {\n if (particle.size.value < minDestroySize) {\n return false;\n }\n particle.velocity.length = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(parent.velocity.length, particle.velocity.length));\n particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;\n particle.unbreakable = true;\n setTimeout(() => {\n particle.unbreakable = false;\n }, unbreakableTime);\n return true;\n });\n}\nfunction split(engine, container, particle) {\n const destroyOptions = particle.options.destroy;\n if (!destroyOptions) {\n return;\n }\n const splitOptions = destroyOptions.split;\n if (splitOptions.count >= minSplitCount && (particle.splitCount === undefined || particle.splitCount++ > splitOptions.count)) {\n return;\n }\n const rate = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.rate.value),\n particlesSplitOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitOptions.particles);\n for (let i = 0; i < rate; i++) {\n addSplitParticle(engine, container, particle, particlesSplitOptions);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Utils.js?\n}");
108
-
109
- /***/ }),
110
-
111
- /***/ "./dist/browser/index.js":
31
+ /***/ "./dist/browser/index.js"
112
32
  /*!*******************************!*\
113
33
  !*** ./dist/browser/index.js ***!
114
34
  \*******************************/
115
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
116
36
 
117
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadDestroyUpdater: () => (/* binding */ loadDestroyUpdater)\n/* harmony export */ });\n/* harmony import */ var _DestroyUpdater_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DestroyUpdater.js */ \"./dist/browser/DestroyUpdater.js\");\n\nasync function loadDestroyUpdater(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n await engine.addParticleUpdater(\"destroy\", container => {\n return Promise.resolve(new _DestroyUpdater_js__WEBPACK_IMPORTED_MODULE_0__.DestroyUpdater(engine, container));\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadDestroyUpdater: () => (/* binding */ loadDestroyUpdater)\n/* harmony export */ });\nfunction loadDestroyUpdater(engine) {\n engine.checkVersion(\"4.0.0-alpha.0\");\n engine.register(e => {\n e.addParticleUpdater(\"destroy\", async container => {\n const {\n DestroyUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_DestroyUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./DestroyUpdater.js */ \"./dist/browser/DestroyUpdater.js\"));\n return new DestroyUpdater(e, container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/index.js?\n}");
118
38
 
119
- /***/ }),
39
+ /***/ },
120
40
 
121
- /***/ "@tsparticles/engine":
41
+ /***/ "@tsparticles/engine"
122
42
  /*!*********************************************************************************************************************************!*\
123
43
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
124
44
  \*********************************************************************************************************************************/
125
- /***/ ((module) => {
45
+ (module) {
126
46
 
127
47
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
128
48
 
129
- /***/ })
49
+ /***/ }
130
50
 
131
51
  /******/ });
132
52
  /************************************************************************/
@@ -140,6 +60,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
140
60
  /******/ if (cachedModule !== undefined) {
141
61
  /******/ return cachedModule.exports;
142
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
+ /******/ }
143
69
  /******/ // Create a new module (and put it into the cache)
144
70
  /******/ var module = __webpack_module_cache__[moduleId] = {
145
71
  /******/ // no module.id needed
@@ -154,19 +80,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
154
80
  /******/ return module.exports;
155
81
  /******/ }
156
82
  /******/
157
- /************************************************************************/
158
- /******/ /* webpack/runtime/compat get default export */
159
- /******/ (() => {
160
- /******/ // getDefaultExport function for compatibility with non-harmony modules
161
- /******/ __webpack_require__.n = (module) => {
162
- /******/ var getter = module && module.__esModule ?
163
- /******/ () => (module['default']) :
164
- /******/ () => (module);
165
- /******/ __webpack_require__.d(getter, { a: getter });
166
- /******/ return getter;
167
- /******/ };
168
- /******/ })();
83
+ /******/ // expose the modules object (__webpack_modules__)
84
+ /******/ __webpack_require__.m = __webpack_modules__;
169
85
  /******/
86
+ /************************************************************************/
170
87
  /******/ /* webpack/runtime/define property getters */
171
88
  /******/ (() => {
172
89
  /******/ // define getter functions for harmony exports
@@ -179,11 +96,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
179
96
  /******/ };
180
97
  /******/ })();
181
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
+ /******/
182
133
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
183
134
  /******/ (() => {
184
135
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
185
136
  /******/ })();
186
137
  /******/
138
+ /******/ /* webpack/runtime/load script */
139
+ /******/ (() => {
140
+ /******/ var inProgress = {};
141
+ /******/ var dataWebpackPrefix = "@tsparticles/updater-destroy:";
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
+ /******/
187
183
  /******/ /* webpack/runtime/make namespace object */
188
184
  /******/ (() => {
189
185
  /******/ // define __esModule on exports
@@ -195,6 +191,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
195
191
  /******/ };
196
192
  /******/ })();
197
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.updater.destroy": 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_updater_destroy"] = this["webpackChunk_tsparticles_updater_destroy"] || [];
303
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
304
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
305
+ /******/ })();
306
+ /******/
198
307
  /************************************************************************/
199
308
  /******/
200
309
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.updater.destroy.min.js.LICENSE.txt */
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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var s in o)("object"==typeof exports?exports:e)[s]=o[s]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},o={};function s(e){var i=o[e];if(void 0!==i)return i.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};s.r(i),s.d(i,{loadDestroyUpdater:()=>h});var n,r=s(303);class l{load(e){(0,r.isNull)(e)||(void 0!==e.bottom&&(this.bottom=(0,r.setRangeValue)(e.bottom)),void 0!==e.left&&(this.left=(0,r.setRangeValue)(e.left)),void 0!==e.right&&(this.right=(0,r.setRangeValue)(e.right)),void 0!==e.top&&(this.top=(0,r.setRangeValue)(e.top)))}}!function(e){e.none="none",e.split="split"}(n||(n={}));class a extends r.ValueWithRandom{constructor(){super(),this.value=3}}class c extends r.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class d{constructor(){this.count=1,this.factor=new a,this.rate=new c,this.sizeOffset=!0}load(e){(0,r.isNull)(e)||(void 0!==e.color&&(this.color=r.OptionsColor.create(this.color,e.color)),void 0!==e.count&&(this.count=e.count),this.factor.load(e.factor),this.rate.load(e.rate),this.particles=(0,r.executeOnSingleOrMultiple)(e.particles,(e=>(0,r.deepExtend)({},e))),void 0!==e.sizeOffset&&(this.sizeOffset=e.sizeOffset),e.colorOffset&&(this.colorOffset=this.colorOffset??{},void 0!==e.colorOffset.h&&(this.colorOffset.h=e.colorOffset.h),void 0!==e.colorOffset.s&&(this.colorOffset.s=e.colorOffset.s),void 0!==e.colorOffset.l&&(this.colorOffset.l=e.colorOffset.l)))}}class u{constructor(){this.bounds=new l,this.mode=n.none,this.split=new d}load(e){(0,r.isNull)(e)||(e.mode&&(this.mode=e.mode),e.bounds&&this.bounds.load(e.bounds),this.split.load(e.split))}}function f(e,t,o,s){const i=o.options.destroy;if(!i)return;const n=i.split,l=(0,r.loadParticlesOptions)(e,t,o.options),a=(0,r.getRangeValue)(n.factor.value),c=o.getFillColor();n.color?l.color.load(n.color):n.colorOffset&&c?l.color.load({value:{hsl:{h:c.h+(0,r.getRangeValue)(n.colorOffset.h??0),s:c.s+(0,r.getRangeValue)(n.colorOffset.s??0),l:c.l+(0,r.getRangeValue)(n.colorOffset.l??0)}}}):l.color.load({value:{hsl:o.getFillColor()}}),l.move.load({center:{x:o.position.x,y:o.position.y,mode:r.PixelMode.precise}}),(0,r.isNumber)(l.size.value)?l.size.value/=a:(l.size.value.min/=a,l.size.value.max/=a),l.load(s);const d=n.sizeOffset?(0,r.setRangeValue)(-o.size.value,o.size.value):0,u={x:o.position.x+(0,r.randomInRange)(d),y:o.position.y+(0,r.randomInRange)(d)};return t.particles.addParticle(u,l,o.group,(e=>!(e.size.value<.5)&&(e.velocity.length=(0,r.randomInRange)((0,r.setRangeValue)(o.velocity.length,e.velocity.length)),e.splitCount=(o.splitCount??0)+1,e.unbreakable=!0,setTimeout((()=>{e.unbreakable=!1}),500),!0)))}class p{constructor(e,t){this.container=t,this.engine=e}init(e){const t=this.container,o=e.options.destroy;if(!o)return;e.splitCount=0;const s=o.bounds;e.destroyBounds||(e.destroyBounds={});const{bottom:i,left:n,right:l,top:a}=s,{destroyBounds:c}=e,d=t.canvas.size;i&&(c.bottom=(0,r.getRangeValue)(i)*d.height/r.percentDenominator),n&&(c.left=(0,r.getRangeValue)(n)*d.width/r.percentDenominator),l&&(c.right=(0,r.getRangeValue)(l)*d.width/r.percentDenominator),a&&(c.top=(0,r.getRangeValue)(a)*d.height/r.percentDenominator)}isEnabled(e){return!e.destroyed}loadOptions(e,...t){e.destroy||(e.destroy=new u);for(const o of t)e.destroy.load(o?.destroy)}particleDestroyed(e,t){if(t)return;const o=e.options.destroy;o&&o.mode===n.split&&function(e,t,o){const s=o.options.destroy;if(!s)return;const i=s.split;if(i.count>=0&&(void 0===o.splitCount||o.splitCount++>i.count))return;const n=(0,r.getRangeValue)(i.rate.value),l=(0,r.itemFromSingleOrMultiple)(i.particles);for(let s=0;s<n;s++)f(e,t,o,l)}(this.engine,this.container,e)}update(e){if(!this.isEnabled(e))return;const t=e.getPosition(),o=e.destroyBounds;o&&(void 0!==o.bottom&&t.y>=o.bottom||void 0!==o.left&&t.x<=o.left||void 0!==o.right&&t.x>=o.right||void 0!==o.top&&t.y<=o.top)&&e.destroy()}}async function h(e,t=!0){e.checkVersion("3.9.1"),await e.addParticleUpdater("destroy",(t=>Promise.resolve(new p(e,t))),t)}return i})()));
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 i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,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/updater-destroy:",i.l=(e,o,n,a)=>{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",i.nc&&s.setAttribute("nonce",i.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)}},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 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(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={114:0};i.f.j=(t,r)=>{var o=i.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 a=i.p+i.u(t),s=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,[a,s,p]=r,c=0;if(a.some((t=>0!==e[t]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(p)p(i)}for(t&&t(r);c<a.length;c++)n=a[c],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function s(e){e.checkVersion("4.0.0-alpha.0"),e.register((e=>{e.addParticleUpdater("destroy",(async t=>{const{DestroyUpdater:r}=await i.e(541).then(i.bind(i,541));return new r(e,t)}))}))}return i.r(a),i.d(a,{loadDestroyUpdater:()=>s}),a})()));
@@ -1 +1 @@
1
- /*! tsParticles Destroy Updater v3.9.1 by Matteo Bruni */
1
+ /*! tsParticles Destroy Updater v4.0.0-alpha.0 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 loadDestroyUpdater(engine: Engine, refresh?: boolean): Promise<void>;
2
+ export declare function loadDestroyUpdater(engine: Engine): void;
@@ -26,9 +26,7 @@
26
26
  }
27
27
  particle.splitCount = 0;
28
28
  const destroyBoundsOptions = destroyOptions.bounds;
29
- if (!particle.destroyBounds) {
30
- particle.destroyBounds = {};
31
- }
29
+ particle.destroyBounds ??= {};
32
30
  const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;
33
31
  if (bottom) {
34
32
  destroyBounds.bottom = ((0, engine_1.getRangeValue)(bottom) * canvasSize.height) / engine_1.percentDenominator;
@@ -47,9 +45,7 @@
47
45
  return !particle.destroyed;
48
46
  }
49
47
  loadOptions(options, ...sources) {
50
- if (!options.destroy) {
51
- options.destroy = new Destroy_js_1.Destroy();
52
- }
48
+ options.destroy ??= new Destroy_js_1.Destroy();
53
49
  for (const source of sources) {
54
50
  options.destroy.load(source?.destroy);
55
51
  }
@@ -59,7 +55,7 @@
59
55
  return;
60
56
  }
61
57
  const destroyOptions = particle.options.destroy;
62
- if (destroyOptions && destroyOptions.mode === DestroyMode_js_1.DestroyMode.split) {
58
+ if (destroyOptions?.mode === DestroyMode_js_1.DestroyMode.split) {
63
59
  (0, Utils_js_1.split)(this.engine, this.container, particle);
64
60
  }
65
61
  }
package/umd/Utils.js CHANGED
@@ -55,14 +55,14 @@
55
55
  }
56
56
  options.load(splitParticlesOptions);
57
57
  const offset = splitOptions.sizeOffset ? (0, engine_1.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset, position = {
58
- x: parent.position.x + (0, engine_1.randomInRange)(offset),
59
- y: parent.position.y + (0, engine_1.randomInRange)(offset),
58
+ x: parent.position.x + (0, engine_1.randomInRangeValue)(offset),
59
+ y: parent.position.y + (0, engine_1.randomInRangeValue)(offset),
60
60
  };
61
61
  return container.particles.addParticle(position, options, parent.group, (particle) => {
62
62
  if (particle.size.value < minDestroySize) {
63
63
  return false;
64
64
  }
65
- particle.velocity.length = (0, engine_1.randomInRange)((0, engine_1.setRangeValue)(parent.velocity.length, particle.velocity.length));
65
+ particle.velocity.length = (0, engine_1.randomInRangeValue)((0, engine_1.setRangeValue)(parent.velocity.length, particle.velocity.length));
66
66
  particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;
67
67
  particle.unbreakable = true;
68
68
  setTimeout(() => {
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", "./DestroyUpdater.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.loadDestroyUpdater = loadDestroyUpdater;
13
- const DestroyUpdater_js_1 = require("./DestroyUpdater.js");
14
- async function loadDestroyUpdater(engine, refresh = true) {
15
- engine.checkVersion("3.9.1");
16
- await engine.addParticleUpdater("destroy", container => {
17
- return Promise.resolve(new DestroyUpdater_js_1.DestroyUpdater(engine, container));
18
- }, refresh);
47
+ function loadDestroyUpdater(engine) {
48
+ engine.checkVersion("4.0.0-alpha.0");
49
+ engine.register(e => {
50
+ e.addParticleUpdater("destroy", async (container) => {
51
+ const { DestroyUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./DestroyUpdater.js"))) : new Promise((resolve_1, reject_1) => { require(["./DestroyUpdater.js"], resolve_1, reject_1); }).then(__importStar));
52
+ return new DestroyUpdater(e, container);
53
+ });
54
+ });
19
55
  }
20
56
  });