@tsparticles/interaction-external-grab
Advanced tools
Comparing version 3.6.0-beta.1 to 3.6.0
@@ -0,1 +1,2 @@ | ||
import { isNull } from "@tsparticles/engine"; | ||
import { GrabLinks } from "./GrabLinks.js"; | ||
@@ -8,3 +9,3 @@ export class Grab { | ||
load(data) { | ||
if (!data) { | ||
if (isNull(data)) { | ||
return; | ||
@@ -11,0 +12,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { OptionsColor } from "@tsparticles/engine"; | ||
import { OptionsColor, isNull } from "@tsparticles/engine"; | ||
export class GrabLinks { | ||
@@ -9,3 +9,3 @@ constructor() { | ||
load(data) { | ||
if (!data) { | ||
if (isNull(data)) { | ||
return; | ||
@@ -12,0 +12,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Grab = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const GrabLinks_js_1 = require("./GrabLinks.js"); | ||
@@ -11,3 +12,3 @@ class Grab { | ||
load(data) { | ||
if (!data) { | ||
if ((0, engine_1.isNull)(data)) { | ||
return; | ||
@@ -14,0 +15,0 @@ } |
@@ -12,3 +12,3 @@ "use strict"; | ||
load(data) { | ||
if (!data) { | ||
if ((0, engine_1.isNull)(data)) { | ||
return; | ||
@@ -15,0 +15,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { isNull } from "@tsparticles/engine"; | ||
import { GrabLinks } from "./GrabLinks.js"; | ||
@@ -8,3 +9,3 @@ export class Grab { | ||
load(data) { | ||
if (!data) { | ||
if (isNull(data)) { | ||
return; | ||
@@ -11,0 +12,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { OptionsColor } from "@tsparticles/engine"; | ||
import { OptionsColor, isNull } from "@tsparticles/engine"; | ||
export class GrabLinks { | ||
@@ -9,3 +9,3 @@ constructor() { | ||
load(data) { | ||
if (!data) { | ||
if (isNull(data)) { | ||
return; | ||
@@ -12,0 +12,0 @@ } |
{ | ||
"name": "@tsparticles/interaction-external-grab", | ||
"version": "3.6.0-beta.1", | ||
"version": "3.6.0", | ||
"description": "tsParticles grab external interaction", | ||
@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.6.0-beta.1" | ||
"@tsparticles/engine": "^3.6.0" | ||
}, | ||
@@ -93,0 +93,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.6.0-beta.1 | ||
* v3.6.0 | ||
*/ | ||
@@ -48,3 +48,3 @@ /* | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* binding */ Grab)\n/* harmony export */ });\n/* harmony import */ var _GrabLinks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\n\nclass Grab {\n constructor() {\n this.distance = 100;\n this.links = new _GrabLinks_js__WEBPACK_IMPORTED_MODULE_0__.GrabLinks();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n this.links.load(data.links);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Options/Classes/Grab.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* binding */ Grab)\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 _GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\n\n\nclass Grab {\n constructor() {\n this.distance = 100;\n this.links = new _GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__.GrabLinks();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n this.links.load(data.links);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Options/Classes/Grab.js?"); | ||
@@ -59,3 +59,3 @@ /***/ }), | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GrabLinks: () => (/* binding */ GrabLinks)\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 GrabLinks {\n constructor() {\n this.blink = false;\n this.consent = false;\n this.opacity = 1;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.blink !== undefined) {\n this.blink = data.blink;\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.consent !== undefined) {\n this.consent = data.consent;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Options/Classes/GrabLinks.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GrabLinks: () => (/* binding */ GrabLinks)\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 GrabLinks {\n constructor() {\n this.blink = false;\n this.consent = false;\n this.opacity = 1;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.blink !== undefined) {\n this.blink = data.blink;\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.consent !== undefined) {\n this.consent = data.consent;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Options/Classes/GrabLinks.js?"); | ||
@@ -62,0 +62,0 @@ /***/ }), |
/*! For license information please see tsparticles.interaction.external.grab.min.js.LICENSE.txt */ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},o={};function i(t){var n=o[t];if(void 0!==n)return n.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,i),r.exports}i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};i.r(n),i.d(n,{Grab:()=>a,GrabLinks:()=>s,loadExternalGrabInteraction:()=>d});var r=i(303);class s{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(t){t&&(void 0!==t.blink&&(this.blink=t.blink),void 0!==t.color&&(this.color=r.OptionsColor.create(this.color,t.color)),void 0!==t.consent&&(this.consent=t.consent),void 0!==t.opacity&&(this.opacity=t.opacity))}}class a{constructor(){this.distance=100,this.links=new s}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links))}}function c(t,e,o,i,n){t.canvas.draw((t=>{const s=e.getPosition();!function(t,e,o,i,n,s){(0,r.drawLine)(t,o,i),t.strokeStyle=(0,r.getStyleFromRgb)(n,s),t.lineWidth=e,t.stroke()}(t,e.retina.linksWidth??0,s,n,o,i)}))}class l extends r.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.grab;e&&(t.retina.grabModeDistance=e.distance*t.retina.pixelRatio)}interact(){const t=this.container,e=t.actualOptions.interactivity;if(!e.modes.grab||!e.events.onHover.enable||t.interactivity.status!==r.mouseMoveEvent)return;const o=t.interactivity.mouse.position;if(!o)return;const i=t.retina.grabModeDistance;if(!i||i<0)return;const n=t.particles.quadTree.queryCircle(o,i,(t=>this.isEnabled(t)));for(const s of n){const n=s.getPosition(),a=(0,r.getDistance)(n,o);if(a>i)continue;const l=e.modes.grab.links,d=l.opacity,p=d-a*d/i;if(p<=0)continue;const b=l.color??s.options.links?.color;if(!t.particles.grabLineColor&&b){const o=e.modes.grab.links;t.particles.grabLineColor=(0,r.getLinkRandomColor)(b,o.blink,o.consent)}const u=(0,r.getLinkColor)(s,void 0,t.particles.grabLineColor);u&&c(t,s,u,p,o)}}isEnabled(t){const e=this.container,o=e.interactivity.mouse,i=(t?.interactivity??e.actualOptions.interactivity).events;return i.onHover.enable&&!!o.position&&(0,r.isInArray)("grab",i.onHover.mode)}loadModeOptions(t,...e){t.grab||(t.grab=new a);for(const o of e)t.grab.load(o?.grab)}reset(){}}async function d(t,e=!0){await t.addInteractor("externalGrab",(t=>Promise.resolve(new l(t))),e)}return n})())); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},o={};function i(t){var n=o[t];if(void 0!==n)return n.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,i),r.exports}i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};i.r(n),i.d(n,{Grab:()=>a,GrabLinks:()=>s,loadExternalGrabInteraction:()=>d});var r=i(303);class s{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(t){(0,r.isNull)(t)||(void 0!==t.blink&&(this.blink=t.blink),void 0!==t.color&&(this.color=r.OptionsColor.create(this.color,t.color)),void 0!==t.consent&&(this.consent=t.consent),void 0!==t.opacity&&(this.opacity=t.opacity))}}class a{constructor(){this.distance=100,this.links=new s}load(t){(0,r.isNull)(t)||(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links))}}function c(t,e,o,i,n){t.canvas.draw((t=>{const s=e.getPosition();!function(t,e,o,i,n,s){(0,r.drawLine)(t,o,i),t.strokeStyle=(0,r.getStyleFromRgb)(n,s),t.lineWidth=e,t.stroke()}(t,e.retina.linksWidth??0,s,n,o,i)}))}class l extends r.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.grab;e&&(t.retina.grabModeDistance=e.distance*t.retina.pixelRatio)}interact(){const t=this.container,e=t.actualOptions.interactivity;if(!e.modes.grab||!e.events.onHover.enable||t.interactivity.status!==r.mouseMoveEvent)return;const o=t.interactivity.mouse.position;if(!o)return;const i=t.retina.grabModeDistance;if(!i||i<0)return;const n=t.particles.quadTree.queryCircle(o,i,(t=>this.isEnabled(t)));for(const s of n){const n=s.getPosition(),a=(0,r.getDistance)(n,o);if(a>i)continue;const l=e.modes.grab.links,d=l.opacity,p=d-a*d/i;if(p<=0)continue;const b=l.color??s.options.links?.color;if(!t.particles.grabLineColor&&b){const o=e.modes.grab.links;t.particles.grabLineColor=(0,r.getLinkRandomColor)(b,o.blink,o.consent)}const u=(0,r.getLinkColor)(s,void 0,t.particles.grabLineColor);u&&c(t,s,u,p,o)}}isEnabled(t){const e=this.container,o=e.interactivity.mouse,i=(t?.interactivity??e.actualOptions.interactivity).events;return i.onHover.enable&&!!o.position&&(0,r.isInArray)("grab",i.onHover.mode)}loadModeOptions(t,...e){t.grab||(t.grab=new a);for(const o of e)t.grab.load(o?.grab)}reset(){}}async function d(t,e=!0){await t.addInteractor("externalGrab",(t=>Promise.resolve(new l(t))),e)}return n})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Grab External Interaction v3.6.0-beta.1 by Matteo Bruni */ | ||
/*! tsParticles Grab External Interaction v3.6.0 by Matteo Bruni */ |
@@ -1,2 +0,2 @@ | ||
import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine"; | ||
import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine"; | ||
import { GrabLinks } from "./GrabLinks.js"; | ||
@@ -3,0 +3,0 @@ import type { IGrab } from "../Interfaces/IGrab.js"; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./GrabLinks.js"], factory); | ||
define(["require", "exports", "@tsparticles/engine", "./GrabLinks.js"], factory); | ||
} | ||
@@ -14,2 +14,3 @@ })(function (require, exports) { | ||
exports.Grab = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const GrabLinks_js_1 = require("./GrabLinks.js"); | ||
@@ -22,3 +23,3 @@ class Grab { | ||
load(data) { | ||
if (!data) { | ||
if ((0, engine_1.isNull)(data)) { | ||
return; | ||
@@ -25,0 +26,0 @@ } |
@@ -21,3 +21,3 @@ (function (factory) { | ||
load(data) { | ||
if (!data) { | ||
if ((0, engine_1.isNull)(data)) { | ||
return; | ||
@@ -24,0 +24,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
330595
986
1
5
Updated@tsparticles/engine@^3.6.0