Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/updater-destroy

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/updater-destroy - npm Package Compare versions

Comparing version 3.2.2 to 3.3.0

830.min.js

8

browser/DestroyUpdater.js

@@ -9,3 +9,3 @@ import { getRangeValue, percentDenominator, } from "@tsparticles/engine";

}
async init(particle) {
init(particle) {
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;

@@ -33,3 +33,2 @@ if (!destroyOptions) {

}
await Promise.resolve();
}

@@ -53,6 +52,6 @@ isEnabled(particle) {

if (destroyOptions && destroyOptions.mode === "split") {
void split(this.engine, this.container, particle);
split(this.engine, this.container, particle);
}
}
async update(particle) {
update(particle) {
if (!this.isEnabled(particle)) {

@@ -71,4 +70,3 @@ return;

}
await Promise.resolve();
}
}
import { getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRange, setRangeValue, } from "@tsparticles/engine";
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
async function addSplitParticle(engine, container, parent, splitParticlesOptions) {
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
const destroyOptions = parent.options.destroy;

@@ -62,3 +62,3 @@ if (!destroyOptions) {

}
export async function split(engine, container, particle) {
export function split(engine, container, particle) {
const destroyOptions = particle.options.destroy;

@@ -75,4 +75,4 @@ if (!destroyOptions) {

for (let i = 0; i < rate; i++) {
await addSplitParticle(engine, container, particle, particlesSplitOptions);
addSplitParticle(engine, container, particle, particlesSplitOptions);
}
}

@@ -12,3 +12,3 @@ "use strict";

}
async init(particle) {
init(particle) {
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;

@@ -36,3 +36,2 @@ if (!destroyOptions) {

}
await Promise.resolve();
}

@@ -56,6 +55,6 @@ isEnabled(particle) {

if (destroyOptions && destroyOptions.mode === "split") {
void (0, Utils_js_1.split)(this.engine, this.container, particle);
(0, Utils_js_1.split)(this.engine, this.container, particle);
}
}
async update(particle) {
update(particle) {
if (!this.isEnabled(particle)) {

@@ -74,5 +73,4 @@ return;

}
await Promise.resolve();
}
}
exports.DestroyUpdater = DestroyUpdater;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -29,3 +6,3 @@ exports.loadDestroyUpdater = void 0;

await engine.addParticleUpdater("destroy", async (container) => {
const { DestroyUpdater } = await Promise.resolve().then(() => __importStar(require("./DestroyUpdater.js")));
const { DestroyUpdater } = await import("./DestroyUpdater.js");
return new DestroyUpdater(engine, container);

@@ -32,0 +9,0 @@ }, refresh);

@@ -6,3 +6,3 @@ "use strict";

const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
async function addSplitParticle(engine, container, parent, splitParticlesOptions) {
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
const destroyOptions = parent.options.destroy;

@@ -66,3 +66,3 @@ if (!destroyOptions) {

}
async function split(engine, container, particle) {
function split(engine, container, particle) {
const destroyOptions = particle.options.destroy;

@@ -79,5 +79,5 @@ if (!destroyOptions) {

for (let i = 0; i < rate; i++) {
await addSplitParticle(engine, container, particle, particlesSplitOptions);
addSplitParticle(engine, container, particle, particlesSplitOptions);
}
}
exports.split = split;

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.2.2
* v3.3.0
*/

@@ -27,3 +27,3 @@ "use strict";

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 _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nclass DestroyUpdater {\n constructor(engine, container) {\n this.container = container;\n this.engine = engine;\n }\n async 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 await Promise.resolve();\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 === \"split\") {\n void (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.split)(this.engine, this.container, particle);\n }\n }\n async 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 await Promise.resolve();\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/DestroyUpdater.js?");
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 _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\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 === \"split\") {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.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?");

@@ -88,3 +88,3 @@ /***/ }),

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;\nasync function 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: \"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}\nasync function 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 await addSplitParticle(engine, container, particle, particlesSplitOptions);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Utils.js?");
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: \"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?");

@@ -91,0 +91,0 @@ /***/ })

@@ -9,3 +9,3 @@ import { getRangeValue, percentDenominator, } from "@tsparticles/engine";

}
async init(particle) {
init(particle) {
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;

@@ -33,3 +33,2 @@ if (!destroyOptions) {

}
await Promise.resolve();
}

@@ -53,6 +52,6 @@ isEnabled(particle) {

if (destroyOptions && destroyOptions.mode === "split") {
void split(this.engine, this.container, particle);
split(this.engine, this.container, particle);
}
}
async update(particle) {
update(particle) {
if (!this.isEnabled(particle)) {

@@ -71,4 +70,3 @@ return;

}
await Promise.resolve();
}
}
import { getRangeValue, isNumber, itemFromSingleOrMultiple, loadParticlesOptions, randomInRange, setRangeValue, } from "@tsparticles/engine";
const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
async function addSplitParticle(engine, container, parent, splitParticlesOptions) {
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
const destroyOptions = parent.options.destroy;

@@ -62,3 +62,3 @@ if (!destroyOptions) {

}
export async function split(engine, container, particle) {
export function split(engine, container, particle) {
const destroyOptions = particle.options.destroy;

@@ -75,4 +75,4 @@ if (!destroyOptions) {

for (let i = 0; i < rate; i++) {
await addSplitParticle(engine, container, particle, particlesSplitOptions);
addSplitParticle(engine, container, particle, particlesSplitOptions);
}
}
{
"name": "@tsparticles/updater-destroy",
"version": "3.2.2",
"version": "3.3.0",
"description": "tsParticles particles destroy updater",

@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.2.2"
"@tsparticles/engine": "^3.3.0"
},

@@ -93,0 +93,0 @@ "publishConfig": {

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.2.2
* v3.3.0
*/

@@ -214,3 +214,3 @@ /*

/******/ var i = scripts.length - 1;
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }

@@ -217,0 +217,0 @@ /******/ }

/*! For license information please see tsparticles.updater.destroy.min.js.LICENSE.txt */
!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={533: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,c;if(void 0!==n)for(var p=document.getElementsByTagName("script"),u=0;u<p.length;u++){var d=p[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){s=d;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var l=(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(l.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=l.bind(null,s.onerror),s.onload=l.bind(null,s.onload),c&&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&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&!e;)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={154: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=r[0],s=r[1],c=r[2],p=0;if(a.some((t=>0!==e[t]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(c)c(i)}for(t&&t(r);p<a.length;p++)n=a[p],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={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("destroy",(async t=>{const{DestroyUpdater:r}=await i.e(190).then(i.bind(i,190));return new r(e,t)}),t)}i.r(a),i.d(a,{loadDestroyUpdater:()=>e})})(),a})()));
!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"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){s=d;break}}s||(p=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var l=(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(l.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=l.bind(null,s.onerror),s.onload=l.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&&(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(/#.*$/,"").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=r[0],s=r[1],p=r[2],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={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("destroy",(async t=>{const{DestroyUpdater:r}=await i.e(830).then(i.bind(i,830));return new r(e,t)}),t)}i.r(a),i.d(a,{loadDestroyUpdater:()=>e})})(),a})()));

@@ -1,1 +0,1 @@

/*! tsParticles Destroy Updater v3.2.2 by Matteo Bruni */
/*! tsParticles Destroy Updater v3.3.0 by Matteo Bruni */

@@ -7,7 +7,7 @@ import { type Container, type Engine, type IParticleUpdater, type Particle, type RecursivePartial } from "@tsparticles/engine";

constructor(engine: Engine, container: Container);
init(particle: DestroyParticle): Promise<void>;
init(particle: DestroyParticle): void;
isEnabled(particle: Particle): boolean;
loadOptions(options: DestroyParticlesOptions, ...sources: (RecursivePartial<IDestroyParticlesOptions> | undefined)[]): void;
particleDestroyed(particle: DestroyParticle, override?: boolean): void;
update(particle: DestroyParticle): Promise<void>;
update(particle: DestroyParticle): void;
}
import { type Container, type Engine } from "@tsparticles/engine";
import type { DestroyParticle } from "./Types.js";
export declare function split(engine: Engine, container: Container, particle: DestroyParticle): Promise<void>;
export declare function split(engine: Engine, container: Container, particle: DestroyParticle): void;

@@ -21,3 +21,3 @@ (function (factory) {

}
async init(particle) {
init(particle) {
const container = this.container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;

@@ -45,3 +45,2 @@ if (!destroyOptions) {

}
await Promise.resolve();
}

@@ -65,6 +64,6 @@ isEnabled(particle) {

if (destroyOptions && destroyOptions.mode === "split") {
void (0, Utils_js_1.split)(this.engine, this.container, particle);
(0, Utils_js_1.split)(this.engine, this.container, particle);
}
}
async update(particle) {
update(particle) {
if (!this.isEnabled(particle)) {

@@ -83,3 +82,2 @@ return;

}
await Promise.resolve();
}

@@ -86,0 +84,0 @@ }

@@ -15,3 +15,3 @@ (function (factory) {

const defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0;
async function addSplitParticle(engine, container, parent, splitParticlesOptions) {
function addSplitParticle(engine, container, parent, splitParticlesOptions) {
const destroyOptions = parent.options.destroy;

@@ -75,3 +75,3 @@ if (!destroyOptions) {

}
async function split(engine, container, particle) {
function split(engine, container, particle) {
const destroyOptions = particle.options.destroy;

@@ -88,3 +88,3 @@ if (!destroyOptions) {

for (let i = 0; i < rate; i++) {
await addSplitParticle(engine, container, particle, particlesSplitOptions);
addSplitParticle(engine, container, particle, particlesSplitOptions);
}

@@ -91,0 +91,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc