@tsparticles/interaction-particles-links 4.0.0-beta.0 → 4.0.0-beta.10

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.
Files changed (43) hide show
  1. package/218.min.js +1 -0
  2. package/540.min.js +1 -0
  3. package/907.min.js +1 -0
  4. package/README.md +31 -0
  5. package/browser/LinkInstance.js +7 -5
  6. package/browser/Linker.js +4 -4
  7. package/browser/LinksPlugin.js +4 -4
  8. package/browser/index.js +6 -6
  9. package/cjs/LinkInstance.js +7 -5
  10. package/cjs/Linker.js +4 -4
  11. package/cjs/LinksPlugin.js +4 -4
  12. package/cjs/index.js +6 -6
  13. package/dist_browser_LinkInstance_js.js +2 -2
  14. package/dist_browser_Linker_js.js +2 -2
  15. package/dist_browser_LinksPlugin_js.js +2 -2
  16. package/esm/LinkInstance.js +7 -5
  17. package/esm/Linker.js +4 -4
  18. package/esm/LinksPlugin.js +4 -4
  19. package/esm/index.js +6 -6
  20. package/package.json +12 -8
  21. package/report.html +84 -29
  22. package/tsparticles.interaction.particles.links.js +2 -2
  23. package/tsparticles.interaction.particles.links.min.js +2 -2
  24. package/types/LinkInstance.d.ts +4 -4
  25. package/types/Linker.d.ts +3 -3
  26. package/types/LinksPlugin.d.ts +3 -3
  27. package/13.min.js +0 -1
  28. package/342.min.js +0 -1
  29. package/823.min.js +0 -1
  30. package/umd/CircleWarp.js +0 -63
  31. package/umd/Interfaces.js +0 -12
  32. package/umd/LinkInstance.js +0 -177
  33. package/umd/Linker.js +0 -127
  34. package/umd/LinksPlugin.js +0 -64
  35. package/umd/Options/Classes/Links.js +0 -80
  36. package/umd/Options/Classes/LinksShadow.js +0 -38
  37. package/umd/Options/Classes/LinksTriangle.js +0 -42
  38. package/umd/Options/Interfaces/ILinks.js +0 -12
  39. package/umd/Options/Interfaces/ILinksShadow.js +0 -12
  40. package/umd/Options/Interfaces/ILinksTriangle.js +0 -12
  41. package/umd/Types.js +0 -12
  42. package/umd/Utils.js +0 -27
  43. package/umd/index.js +0 -68
@@ -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
- * v4.0.0-beta.0
7
+ * v4.0.0-beta.10
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -84,7 +84,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
84
84
  \*******************************/
85
85
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
86
86
 
87
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Links: () => (/* reexport safe */ _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_0__.Links),\n/* harmony export */ LinksShadow: () => (/* reexport safe */ _Options_Classes_LinksShadow_js__WEBPACK_IMPORTED_MODULE_1__.LinksShadow),\n/* harmony export */ LinksTriangle: () => (/* reexport safe */ _Options_Classes_LinksTriangle_js__WEBPACK_IMPORTED_MODULE_2__.LinksTriangle),\n/* harmony export */ loadParticlesLinksInteraction: () => (/* binding */ loadParticlesLinksInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Links.js */ \"./dist/browser/Options/Classes/Links.js\");\n/* harmony import */ var _Options_Classes_LinksShadow_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/LinksShadow.js */ \"./dist/browser/Options/Classes/LinksShadow.js\");\n/* harmony import */ var _Options_Classes_LinksTriangle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/LinksTriangle.js */ \"./dist/browser/Options/Classes/LinksTriangle.js\");\nasync function loadParticlesLinksInteraction(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const [{ ensureInteractivityPluginLoaded }, { LinksPlugin }] = await Promise.all([\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19)),\n __webpack_require__.e(/*! import() */ \"dist_browser_LinksPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./LinksPlugin.js */ \"./dist/browser/LinksPlugin.js\"))\n ]);\n ensureInteractivityPluginLoaded(e);\n e.addPlugin(new LinksPlugin(e));\n e.addInteractor?.(\"particlesLinks\", async (container)=>{\n const { Linker } = await __webpack_require__.e(/*! import() */ \"dist_browser_Linker_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Linker.js */ \"./dist/browser/Linker.js\"));\n return new Linker(container, e);\n });\n });\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/index.js?\n}");
87
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Links: () => (/* reexport safe */ _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_0__.Links),\n/* harmony export */ LinksShadow: () => (/* reexport safe */ _Options_Classes_LinksShadow_js__WEBPACK_IMPORTED_MODULE_1__.LinksShadow),\n/* harmony export */ LinksTriangle: () => (/* reexport safe */ _Options_Classes_LinksTriangle_js__WEBPACK_IMPORTED_MODULE_2__.LinksTriangle),\n/* harmony export */ loadParticlesLinksInteraction: () => (/* binding */ loadParticlesLinksInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Links.js */ \"./dist/browser/Options/Classes/Links.js\");\n/* harmony import */ var _Options_Classes_LinksShadow_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/LinksShadow.js */ \"./dist/browser/Options/Classes/LinksShadow.js\");\n/* harmony import */ var _Options_Classes_LinksTriangle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/LinksTriangle.js */ \"./dist/browser/Options/Classes/LinksTriangle.js\");\nasync function loadParticlesLinksInteraction(engine) {\n engine.checkVersion(\"4.0.0-beta.10\");\n await engine.pluginManager.register(async (e)=>{\n const pluginManager = e.pluginManager, [{ ensureInteractivityPluginLoaded }, { LinksPlugin }] = await Promise.all([\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19)),\n __webpack_require__.e(/*! import() */ \"dist_browser_LinksPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./LinksPlugin.js */ \"./dist/browser/LinksPlugin.js\"))\n ]);\n ensureInteractivityPluginLoaded(e);\n pluginManager.addPlugin(new LinksPlugin(pluginManager));\n pluginManager.addInteractor?.(\"particlesLinks\", async (container)=>{\n const { Linker } = await __webpack_require__.e(/*! import() */ \"dist_browser_Linker_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Linker.js */ \"./dist/browser/Linker.js\"));\n return new Linker(pluginManager, container);\n });\n });\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/index.js?\n}");
88
88
 
89
89
  /***/ }
90
90
 
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):t(e.window,e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e,t)=>(()=>{"use strict";var r,i,o,n={303(t){t.exports=e},702(e){e.exports=t},348(e,t,r){r.d(t,{q:()=>s});var i=r(303),o=r(724),n=r(200);class s{blink;color;consent;distance;enable;frequency;id;opacity;shadow;triangles;warp;width;constructor(){this.blink=!1,this.color=new i.OptionsColor,this.color.value="#fff",this.consent=!1,this.distance=100,this.enable=!1,this.frequency=1,this.opacity=1,this.shadow=new o.s,this.triangles=new n.G,this.width=1,this.warp=!1}load(e){(0,i.isNull)(e)||(void 0!==e.id&&(this.id=e.id),void 0!==e.blink&&(this.blink=e.blink),this.color=i.OptionsColor.create(this.color,e.color),void 0!==e.consent&&(this.consent=e.consent),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.frequency&&(this.frequency=e.frequency),void 0!==e.opacity&&(this.opacity=e.opacity),this.shadow.load(e.shadow),this.triangles.load(e.triangles),void 0!==e.width&&(this.width=e.width),void 0!==e.warp&&(this.warp=e.warp))}}},724(e,t,r){r.d(t,{s:()=>o});var i=r(303);class o{blur;color;enable;constructor(){this.blur=5,this.color=new i.OptionsColor,this.color.value="#000",this.enable=!1}load(e){(0,i.isNull)(e)||(void 0!==e.blur&&(this.blur=e.blur),this.color=i.OptionsColor.create(this.color,e.color),void 0!==e.enable&&(this.enable=e.enable))}}},200(e,t,r){r.d(t,{G:()=>o});var i=r(303);class o{color;enable;frequency;opacity;constructor(){this.enable=!1,this.frequency=1}load(e){(0,i.isNull)(e)||(void 0!==e.color&&(this.color=i.OptionsColor.create(this.color,e.color)),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.frequency&&(this.frequency=e.frequency),void 0!==e.opacity&&(this.opacity=e.opacity))}}}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);a.r(r);var i={};l=l||[null,c({}),c([]),c(c)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~l.indexOf(o);o=c(o))Object.getOwnPropertyNames(o).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,a.d(r,i),r},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},a.l=(e,t,r,i)=>{if(p[e])return void p[e].push(t);if(void 0!==r)for(var o,n,s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var c=s[l];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/interaction-particles-links:"+r){o=c;break}}o||(n=!0,(o=document.createElement("script")).charset="utf-8",a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack","@tsparticles/interaction-particles-links:"+r),o.src=e),p[e]=[t];var d=(t,r)=>{o.onerror=o.onload=null,clearTimeout(u);var i=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(r)),t)return t(r)},u=setTimeout(d.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=d.bind(null,o.onerror),o.onload=d.bind(null,o.onload),n&&document.head.appendChild(o)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(d=a.g.location+"");var l,c,p,d,u=a.g.document;if(!d&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(d=u.currentScript.src),!d)){var h=u.getElementsByTagName("script");if(h.length)for(var f=h.length-1;f>-1&&(!d||!/^http(s?):/.test(d));)d=h[f--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");a.p=d=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={203:0},a.f.j=(e,t)=>{var i=a.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[2]);else{var o=new Promise((t,o)=>i=r[e]=[t,o]);t.push(i[2]=o);var n=a.p+a.u(e),s=Error();a.l(n,t=>{if(a.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;s.message="Loading chunk "+e+` failed.
2
- (`+o+": "+n+")",s.name="ChunkLoadError",s.type=o,s.request=n,i[1](s)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[n,s,l]=t,c=0;if(n.some(e=>0!==r[e])){for(i in s)a.o(s,i)&&(a.m[i]=s[i]);l&&l(a)}for(e&&e(t);c<n.length;c++)o=n[c],a.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_interaction_particles_links=this.webpackChunk_tsparticles_interaction_particles_links||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var b={};a.r(b),a.d(b,{Links:()=>v.q,LinksShadow:()=>y.s,LinksTriangle:()=>g.G,loadParticlesLinksInteraction:()=>w});var v=a(348),y=a(724),g=a(200);async function w(e){e.checkVersion("4.0.0-beta.0"),await e.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{LinksPlugin:r}]=await Promise.all([Promise.resolve().then(a.t.bind(a,702,19)),a.e(13).then(a.bind(a,13))]);t(e),e.addPlugin(new r(e)),e.addInteractor?.("particlesLinks",async t=>{let{Linker:r}=await a.e(342).then(a.bind(a,342));return new r(t,e)})})}return b})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):t(e.window,e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e,t)=>(()=>{"use strict";var r,i,o,n={303(t){t.exports=e},702(e){e.exports=t},861(e,t,r){r.d(t,{q:()=>a});var i=r(303),o=r(853),n=r(517);class a{blink;color;consent;distance;enable;frequency;id;opacity;shadow;triangles;warp;width;constructor(){this.blink=!1,this.color=new i.OptionsColor,this.color.value="#fff",this.consent=!1,this.distance=100,this.enable=!1,this.frequency=1,this.opacity=1,this.shadow=new o.s,this.triangles=new n.G,this.width=1,this.warp=!1}load(e){(0,i.isNull)(e)||(void 0!==e.id&&(this.id=e.id),void 0!==e.blink&&(this.blink=e.blink),this.color=i.OptionsColor.create(this.color,e.color),void 0!==e.consent&&(this.consent=e.consent),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.frequency&&(this.frequency=e.frequency),void 0!==e.opacity&&(this.opacity=e.opacity),this.shadow.load(e.shadow),this.triangles.load(e.triangles),void 0!==e.width&&(this.width=e.width),void 0!==e.warp&&(this.warp=e.warp))}}},853(e,t,r){r.d(t,{s:()=>o});var i=r(303);class o{blur;color;enable;constructor(){this.blur=5,this.color=new i.OptionsColor,this.color.value="#000",this.enable=!1}load(e){(0,i.isNull)(e)||(void 0!==e.blur&&(this.blur=e.blur),this.color=i.OptionsColor.create(this.color,e.color),void 0!==e.enable&&(this.enable=e.enable))}}},517(e,t,r){r.d(t,{G:()=>o});var i=r(303);class o{color;enable;frequency;opacity;constructor(){this.enable=!1,this.frequency=1}load(e){(0,i.isNull)(e)||(void 0!==e.color&&(this.color=i.OptionsColor.create(this.color,e.color)),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.frequency&&(this.frequency=e.frequency),void 0!==e.opacity&&(this.opacity=e.opacity))}}}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,s),r.exports}s.m=n,c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);s.r(r);var i={};l=l||[null,c({}),c([]),c(c)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~l.indexOf(o);o=c(o))Object.getOwnPropertyNames(o).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},s.l=(e,t,r,i)=>{if(p[e])return void p[e].push(t);if(void 0!==r)for(var o,n,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/interaction-particles-links:"+r){o=c;break}}o||(n=!0,(o=document.createElement("script")).charset="utf-8",s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-webpack","@tsparticles/interaction-particles-links:"+r),o.src=e),p[e]=[t];var d=(t,r)=>{o.onerror=o.onload=null,clearTimeout(u);var i=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(r)),t)return t(r)},u=setTimeout(d.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=d.bind(null,o.onerror),o.onload=d.bind(null,o.onload),n&&document.head.appendChild(o)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(d=s.g.location+"");var l,c,p,d,u=s.g.document;if(!d&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(d=u.currentScript.src),!d)){var h=u.getElementsByTagName("script");if(h.length)for(var f=h.length-1;f>-1&&(!d||!/^http(s?):/.test(d));)d=h[f--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");s.p=d=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={203:0},s.f.j=(e,t)=>{var i=s.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[2]);else{var o=new Promise((t,o)=>i=r[e]=[t,o]);t.push(i[2]=o);var n=s.p+s.u(e),a=Error();s.l(n,t=>{if(s.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;a.message="Loading chunk "+e+` failed.
2
+ (`+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[n,a,l]=t,c=0;if(n.some(e=>0!==r[e])){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);l&&l(s)}for(e&&e(t);c<n.length;c++)o=n[c],s.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_interaction_particles_links=this.webpackChunk_tsparticles_interaction_particles_links||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var b={};s.r(b),s.d(b,{Links:()=>v.q,LinksShadow:()=>y.s,LinksTriangle:()=>g.G,loadParticlesLinksInteraction:()=>w});var v=s(861),y=s(853),g=s(517);async function w(e){e.checkVersion("4.0.0-beta.10"),await e.pluginManager.register(async e=>{let t=e.pluginManager,[{ensureInteractivityPluginLoaded:r},{LinksPlugin:i}]=await Promise.all([Promise.resolve().then(s.t.bind(s,702,19)),s.e(540).then(s.bind(s,540))]);r(e),t.addPlugin(new i(t)),t.addInteractor?.("particlesLinks",async e=>{let{Linker:r}=await s.e(907).then(s.bind(s,907));return new r(t,e)})})}return b})());
@@ -1,12 +1,12 @@
1
- import { type Engine, type IContainerPlugin } from "@tsparticles/engine";
1
+ import { type CanvasContextType, type IContainerPlugin, type PluginManager } from "@tsparticles/engine";
2
2
  import type { LinkContainer, LinkParticle } from "./Types.js";
3
3
  export declare class LinkInstance implements IContainerPlugin {
4
4
  private readonly _colorCache;
5
5
  private readonly _container;
6
- private readonly _engine;
7
6
  private readonly _freqs;
8
- constructor(container: LinkContainer, engine: Engine);
9
- drawParticle(context: CanvasRenderingContext2D, particle: LinkParticle): void;
7
+ private readonly _pluginManager;
8
+ constructor(pluginManager: PluginManager, container: LinkContainer);
9
+ drawParticle(context: CanvasContextType, particle: LinkParticle): void;
10
10
  init(): Promise<void>;
11
11
  particleCreated(particle: LinkParticle): void;
12
12
  particleDestroyed(particle: LinkParticle): void;
package/types/Linker.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { type Engine, type RecursivePartial } from "@tsparticles/engine";
1
+ import { type PluginManager, type RecursivePartial } from "@tsparticles/engine";
2
2
  import type { IParticlesLinkOptions, LinkContainer, LinkParticle, ParticlesLinkOptions } from "./Types.js";
3
3
  import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
4
4
  export declare class Linker extends ParticlesInteractorBase<LinkContainer, LinkParticle> {
5
- private readonly _engine;
6
5
  private _maxDistance;
7
- constructor(container: LinkContainer, engine: Engine);
6
+ private readonly _pluginManager;
7
+ constructor(pluginManager: PluginManager, container: LinkContainer);
8
8
  get maxDistance(): number;
9
9
  clear(): void;
10
10
  init(): void;
@@ -1,10 +1,10 @@
1
- import { type Engine, type IPlugin } from "@tsparticles/engine";
1
+ import { type IPlugin, type PluginManager } from "@tsparticles/engine";
2
2
  import type { LinkContainer } from "./Types.js";
3
3
  import type { LinkInstance } from "./LinkInstance.js";
4
4
  export declare class LinksPlugin implements IPlugin {
5
5
  readonly id = "links";
6
- private readonly _engine;
7
- constructor(engine: Engine);
6
+ private readonly _pluginManager;
7
+ constructor(pluginManager: PluginManager);
8
8
  getPlugin(container: LinkContainer): Promise<LinkInstance>;
9
9
  loadOptions(): void;
10
10
  needsPlugin(): boolean;
package/13.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_interaction_particles_links=this.webpackChunk_tsparticles_interaction_particles_links||[]).push([[13],{13(n,i,t){t.r(i),t.d(i,{LinksPlugin:()=>e});class e{id="links";_engine;constructor(n){this._engine=n}async getPlugin(n){let{LinkInstance:i}=await t.e(823).then(t.bind(t,823));return new i(n,this._engine)}loadOptions(){}needsPlugin(){return!0}}}}]);
package/342.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_interaction_particles_links=this.webpackChunk_tsparticles_interaction_particles_links||[]).push([[342],{342(i,t,n){n.d(t,{Linker:()=>a});var s=n(303);class e extends s.Circle{canvasSize;constructor(i,t,n,s){super(i,t,n),this.canvasSize=s}contains(i){if(super.contains(i))return!0;let{width:t,height:n}=this.canvasSize,{x:s,y:e}=i;return super.contains({x:s-t,y:e})||super.contains({x:s+t,y:e})||super.contains({x:s,y:e-n})||super.contains({x:s,y:e+n})||super.contains({x:s-t,y:e-n})||super.contains({x:s+t,y:e+n})||super.contains({x:s-t,y:e+n})||super.contains({x:s+t,y:e-n})}intersects(i){if(super.intersects(i))return!0;let{width:t,height:n}=this.canvasSize,e=i.position;for(let r of[{x:-t,y:0},{x:t,y:0},{x:0,y:-n},{x:0,y:n},{x:-t,y:-n},{x:t,y:n},{x:-t,y:n},{x:t,y:-n}]){let t,n={x:e.x+r.x,y:e.y+r.y};if(t=i instanceof s.Circle?new s.Circle(n.x,n.y,i.radius):new s.Rectangle(n.x,n.y,i.size.width,i.size.height),super.intersects(t))return!0}return!1}}var r=n(348),o=n(702);class a extends o.ParticlesInteractorBase{_engine;_maxDistance;constructor(i,t){super(i),this._engine=t,this._maxDistance=0}get maxDistance(){return this._maxDistance}clear(){}init(){this.container.particles.linksColor=void 0,this.container.particles.linksColors=new Map}interact(i){if(!i.options.links)return;i.links=[],i.linksDistance&&i.linksDistance>this._maxDistance&&(this._maxDistance=i.linksDistance);let t=i.getPosition(),n=this.container,r=n.canvas.size;if(t.x<s.originPoint.x||t.y<s.originPoint.y||t.x>r.width||t.y>r.height)return;let o=i.options.links,a=o.opacity,l=i.retina.linksDistance??0,c=o.warp,p=c?new e(t.x,t.y,l,r):new s.Circle(t.x,t.y,l);for(let e of n.particles.grid.query(p)){let n=e.options.links;if(i===e||!n?.enable||o.id!==n.id||e.spawning||e.destroyed||!e.links||i.links.some(i=>i.destination===e)||e.links.some(t=>t.destination===i))continue;let p=e.getPosition();if(p.x<s.originPoint.x||p.y<s.originPoint.y||p.x>r.width||p.y>r.height)continue;let h=(0,s.getDistances)(t,p).distance,x=c&&n.warp?function(i,t,n){let{dx:e,dy:r}=(0,s.getDistances)(i,t),o={x:Math.abs(e),y:Math.abs(r)},a={x:Math.min(o.x,n.width-o.x),y:Math.min(o.y,n.height-o.y)};return Math.hypot(a.x,a.y)}(t,p,r):h,k=Math.min(h,x);if(k>l)continue;let u=(1-k/l)*a;this._setColor(i),i.links.push({destination:e,opacity:u,color:this._getLinkColor(i,e),isWarped:x<h})}}isEnabled(i){return!!i.options.links?.enable}loadParticlesOptions(i,...t){for(let n of(i.links??=new r.q,t))i.links.load(n?.links)}reset(){}_getLinkColor(i,t){let n=this.container,e=i.options.links;if(!e)return;let r=void 0!==e.id?n.particles.linksColors.get(e.id):n.particles.linksColor;return(0,s.getLinkColor)(i,t,r)}_setColor(i){if(!i.options.links)return;let t=this.container,n=i.options.links,e=void 0===n.id?t.particles.linksColor:t.particles.linksColors.get(n.id);e||(e=(0,s.getLinkRandomColor)(this._engine,n.color,n.blink,n.consent),void 0===n.id?t.particles.linksColor=e:t.particles.linksColors.set(n.id,e))}}}}]);
package/823.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_interaction_particles_links=this.webpackChunk_tsparticles_interaction_particles_links||[]).push([[823],{823(e,i,t){t.d(i,{LinkInstance:()=>s});var n=t(303);function l(e,i){let t=[...e.map(e=>e.id)].sort((e,i)=>e-i).join("_"),l=i.get(t);return void 0===l&&(l=(0,n.getRandom)(),i.set(t,l)),l}class s{_colorCache=new Map;_container;_engine;_freqs;constructor(e,i){this._container=e,this._engine=i,this._freqs={links:new Map,triangles:new Map}}drawParticle(e,i){let{links:t,options:l}=i;if(!t?.length||!l.links)return;let s=l.links,o=i.retina.linksWidth??0,a=i.getPosition(),r=i.options.twinkle?.links,c=s.triangles.enable,h=c?new Set(t.map(e=>e.destination.id)):null,g=e.globalAlpha,d="",_=-1,k=-1,p=!1,y=()=>{p&&(e.stroke(),p=!1)};for(let g of t){if(s.frequency<1&&this._getLinkFrequency(i,g.destination)>s.frequency)continue;let t=g.destination.getPosition();if(c&&!g.isWarped&&h&&(y(),this._drawTriangles(l,i,g,h,a,t,e)),g.opacity<=0||o<=0||!s.enable)continue;let f=g.opacity,u=g.color,b=r?.enable&&(0,n.getRandom)()<r.frequency?(0,n.rangeColorToRgb)(this._engine,r.color):void 0;if(r&&b&&(u=b,f=(0,n.getRangeValue)(r.opacity)),!u){let e=void 0!==s.id?this._container.particles.linksColors.get(s.id):this._container.particles.linksColor;u=(0,n.getLinkColor)(i,g.destination,e)}if(!u)continue;let q=this._getCachedStyle(u);if((q!==d||o!==_||f!==k)&&(y(),e.strokeStyle=q,e.lineWidth=o,e.globalAlpha=f,d=q,_=o,k=f,e.beginPath(),p=!0),g.isWarped){let i=this._container.canvas.size,l=t.x-a.x,s=t.y-a.y,o=n.originPoint.x,r=n.originPoint.y;Math.abs(l)>i.width*n.half&&(o=l>0?-i.width:i.width),Math.abs(s)>i.height*n.half&&(r=s>0?-i.height:i.height),e.moveTo(a.x,a.y),e.lineTo(t.x+o,t.y+r),e.moveTo(a.x-o,a.y-r),e.lineTo(t.x,t.y)}else e.moveTo(a.x,a.y),e.lineTo(t.x,t.y)}y(),e.globalAlpha=g}init(){return this._freqs.links.clear(),this._freqs.triangles.clear(),this._colorCache.clear(),Promise.resolve()}particleCreated(e){if(e.links=[],!e.options.links)return;e.linksDistance=e.options.links.distance,e.linksWidth=e.options.links.width;let i=this._container.retina.pixelRatio;e.retina.linksDistance=e.linksDistance*i,e.retina.linksWidth=e.linksWidth*i}particleDestroyed(e){e.links=[]}_drawTriangles(e,i,t,l,s,o,a){let r=t.destination,c=e.links?.triangles;if(!c?.enable||!r.options.links?.triangles.enable)return;let h=r.links;if(h?.length)for(let g of h){if(g.isWarped||this._getLinkFrequency(r,g.destination)>r.options.links.frequency||!l.has(g.destination.id))continue;let h=g.destination;if(this._getTriangleFrequency(i,r,h)>(e.links?.triangles.frequency??0))continue;let d=c.opacity??(t.opacity+g.opacity)*n.half,_=(0,n.rangeColorToRgb)(this._engine,c.color)??t.color;if(!_||d<=0)continue;let k=h.getPosition();a.save(),a.fillStyle=this._getCachedStyle(_),a.globalAlpha=d,a.beginPath(),a.moveTo(s.x,s.y),a.lineTo(o.x,o.y),a.lineTo(k.x,k.y),a.closePath(),a.fill(),a.restore()}}_getCachedStyle(e){let i=`${e.r},${e.g},${e.b}`,t=this._colorCache.get(i);return t||(t=(0,n.getStyleFromRgb)(e,this._container.hdr),this._colorCache.set(i,t)),t}_getLinkFrequency(e,i){return l([e,i],this._freqs.links)}_getTriangleFrequency(e,i,t){return l([e,i,t],this._freqs.triangles)}}}}]);
package/umd/CircleWarp.js DELETED
@@ -1,63 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CircleWarp = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class CircleWarp extends engine_1.Circle {
15
- canvasSize;
16
- constructor(x, y, radius, canvasSize) {
17
- super(x, y, radius);
18
- this.canvasSize = canvasSize;
19
- }
20
- contains(point) {
21
- if (super.contains(point))
22
- return true;
23
- const { width, height } = this.canvasSize, { x, y } = point;
24
- return (super.contains({ x: x - width, y }) ||
25
- super.contains({ x: x + width, y }) ||
26
- super.contains({ x, y: y - height }) ||
27
- super.contains({ x, y: y + height }) ||
28
- super.contains({ x: x - width, y: y - height }) ||
29
- super.contains({ x: x + width, y: y + height }) ||
30
- super.contains({ x: x - width, y: y + height }) ||
31
- super.contains({ x: x + width, y: y - height }));
32
- }
33
- intersects(range) {
34
- if (super.intersects(range))
35
- return true;
36
- const { width, height } = this.canvasSize, pos = range.position, shifts = [
37
- { x: -width, y: 0 },
38
- { x: width, y: 0 },
39
- { x: 0, y: -height },
40
- { x: 0, y: height },
41
- { x: -width, y: -height },
42
- { x: width, y: height },
43
- { x: -width, y: height },
44
- { x: width, y: -height },
45
- ];
46
- for (const shift of shifts) {
47
- const shiftedPos = { x: pos.x + shift.x, y: pos.y + shift.y };
48
- let shiftedRange;
49
- if (range instanceof engine_1.Circle) {
50
- shiftedRange = new engine_1.Circle(shiftedPos.x, shiftedPos.y, range.radius);
51
- }
52
- else {
53
- const rect = range;
54
- shiftedRange = new engine_1.Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
55
- }
56
- if (super.intersects(shiftedRange))
57
- return true;
58
- }
59
- return false;
60
- }
61
- }
62
- exports.CircleWarp = CircleWarp;
63
- });
package/umd/Interfaces.js DELETED
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,177 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./Utils.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.LinkInstance = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- const Utils_js_1 = require("./Utils.js");
15
- const minOpacity = 0, minWidth = 0, minDistance = 0, maxFrequency = 1, defaultFrequency = 0;
16
- class LinkInstance {
17
- _colorCache = new Map();
18
- _container;
19
- _engine;
20
- _freqs;
21
- constructor(container, engine) {
22
- this._container = container;
23
- this._engine = engine;
24
- this._freqs = { links: new Map(), triangles: new Map() };
25
- }
26
- drawParticle(context, particle) {
27
- const { links, options } = particle;
28
- if (!links?.length || !options.links) {
29
- return;
30
- }
31
- const linkOpts = options.links, width = particle.retina.linksWidth ?? minWidth, pos1 = particle.getPosition(), twinkle = particle.options["twinkle"]?.links, trianglesEnabled = linkOpts.triangles.enable, p1Destinations = trianglesEnabled ? new Set(links.map(l => l.destination.id)) : null, originalAlpha = context.globalAlpha;
32
- let currentColorStyle = "", currentWidth = -1, currentAlpha = -1, pathOpen = false;
33
- const flushLines = () => {
34
- if (pathOpen) {
35
- context.stroke();
36
- pathOpen = false;
37
- }
38
- };
39
- for (const link of links) {
40
- if (linkOpts.frequency < maxFrequency &&
41
- this._getLinkFrequency(particle, link.destination) > linkOpts.frequency) {
42
- continue;
43
- }
44
- const pos2 = link.destination.getPosition();
45
- if (trianglesEnabled && !link.isWarped && p1Destinations) {
46
- flushLines();
47
- this._drawTriangles(options, particle, link, p1Destinations, pos1, pos2, context);
48
- }
49
- if (link.opacity <= minOpacity || width <= minWidth) {
50
- continue;
51
- }
52
- if (!linkOpts.enable) {
53
- continue;
54
- }
55
- let opacity = link.opacity, colorLine = link.color;
56
- const twinkleRgb = twinkle?.enable && (0, engine_1.getRandom)() < twinkle.frequency ? (0, engine_1.rangeColorToRgb)(this._engine, twinkle.color) : undefined;
57
- if (twinkle && twinkleRgb) {
58
- colorLine = twinkleRgb;
59
- opacity = (0, engine_1.getRangeValue)(twinkle.opacity);
60
- }
61
- if (!colorLine) {
62
- const linkColor = linkOpts.id !== undefined
63
- ? this._container.particles.linksColors.get(linkOpts.id)
64
- : this._container.particles.linksColor;
65
- colorLine = (0, engine_1.getLinkColor)(particle, link.destination, linkColor);
66
- }
67
- if (!colorLine) {
68
- continue;
69
- }
70
- const colorStyle = this._getCachedStyle(colorLine);
71
- if (colorStyle !== currentColorStyle || width !== currentWidth || opacity !== currentAlpha) {
72
- flushLines();
73
- context.strokeStyle = colorStyle;
74
- context.lineWidth = width;
75
- context.globalAlpha = opacity;
76
- currentColorStyle = colorStyle;
77
- currentWidth = width;
78
- currentAlpha = opacity;
79
- context.beginPath();
80
- pathOpen = true;
81
- }
82
- if (link.isWarped) {
83
- const canvasSize = this._container.canvas.size, dx = pos2.x - pos1.x, dy = pos2.y - pos1.y;
84
- let sx = engine_1.originPoint.x, sy = engine_1.originPoint.y;
85
- if (Math.abs(dx) > canvasSize.width * engine_1.half) {
86
- sx = dx > minDistance ? -canvasSize.width : canvasSize.width;
87
- }
88
- if (Math.abs(dy) > canvasSize.height * engine_1.half) {
89
- sy = dy > minDistance ? -canvasSize.height : canvasSize.height;
90
- }
91
- context.moveTo(pos1.x, pos1.y);
92
- context.lineTo(pos2.x + sx, pos2.y + sy);
93
- context.moveTo(pos1.x - sx, pos1.y - sy);
94
- context.lineTo(pos2.x, pos2.y);
95
- }
96
- else {
97
- context.moveTo(pos1.x, pos1.y);
98
- context.lineTo(pos2.x, pos2.y);
99
- }
100
- }
101
- flushLines();
102
- context.globalAlpha = originalAlpha;
103
- }
104
- init() {
105
- this._freqs.links.clear();
106
- this._freqs.triangles.clear();
107
- this._colorCache.clear();
108
- return Promise.resolve();
109
- }
110
- particleCreated(particle) {
111
- particle.links = [];
112
- if (!particle.options.links) {
113
- return;
114
- }
115
- particle.linksDistance = particle.options.links.distance;
116
- particle.linksWidth = particle.options.links.width;
117
- const ratio = this._container.retina.pixelRatio;
118
- particle.retina.linksDistance = particle.linksDistance * ratio;
119
- particle.retina.linksWidth = particle.linksWidth * ratio;
120
- }
121
- particleDestroyed(particle) {
122
- particle.links = [];
123
- }
124
- _drawTriangles(options, p1, link, p1Destinations, pos1, pos2, context) {
125
- const p2 = link.destination, triangleOptions = options.links?.triangles;
126
- if (!triangleOptions?.enable || !p2.options.links?.triangles.enable) {
127
- return;
128
- }
129
- const p2Links = p2.links;
130
- if (!p2Links?.length) {
131
- return;
132
- }
133
- for (const vertex of p2Links) {
134
- if (vertex.isWarped ||
135
- this._getLinkFrequency(p2, vertex.destination) > p2.options.links.frequency ||
136
- !p1Destinations.has(vertex.destination.id)) {
137
- continue;
138
- }
139
- const p3 = vertex.destination;
140
- if (this._getTriangleFrequency(p1, p2, p3) > (options.links?.triangles.frequency ?? defaultFrequency)) {
141
- continue;
142
- }
143
- const opacityTriangle = triangleOptions.opacity ?? (link.opacity + vertex.opacity) * engine_1.half, colorTriangle = (0, engine_1.rangeColorToRgb)(this._engine, triangleOptions.color) ?? link.color;
144
- if (!colorTriangle || opacityTriangle <= minOpacity) {
145
- continue;
146
- }
147
- const pos3 = p3.getPosition();
148
- context.save();
149
- context.fillStyle = this._getCachedStyle(colorTriangle);
150
- context.globalAlpha = opacityTriangle;
151
- context.beginPath();
152
- context.moveTo(pos1.x, pos1.y);
153
- context.lineTo(pos2.x, pos2.y);
154
- context.lineTo(pos3.x, pos3.y);
155
- context.closePath();
156
- context.fill();
157
- context.restore();
158
- }
159
- }
160
- _getCachedStyle(rgb) {
161
- const key = `${rgb.r},${rgb.g},${rgb.b}`;
162
- let style = this._colorCache.get(key);
163
- if (!style) {
164
- style = (0, engine_1.getStyleFromRgb)(rgb, this._container.hdr);
165
- this._colorCache.set(key, style);
166
- }
167
- return style;
168
- }
169
- _getLinkFrequency(p1, p2) {
170
- return (0, Utils_js_1.setLinkFrequency)([p1, p2], this._freqs.links);
171
- }
172
- _getTriangleFrequency(p1, p2, p3) {
173
- return (0, Utils_js_1.setLinkFrequency)([p1, p2, p3], this._freqs.triangles);
174
- }
175
- }
176
- exports.LinkInstance = LinkInstance;
177
- });
package/umd/Linker.js DELETED
@@ -1,127 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./CircleWarp.js", "./Options/Classes/Links.js", "@tsparticles/plugin-interactivity"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Linker = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- const CircleWarp_js_1 = require("./CircleWarp.js");
15
- const Links_js_1 = require("./Options/Classes/Links.js");
16
- const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
17
- const opacityOffset = 1, minDistance = 0;
18
- function getWarpDistance(pos1, pos2, canvasSize) {
19
- const { dx, dy } = (0, engine_1.getDistances)(pos1, pos2), absDiffs = { x: Math.abs(dx), y: Math.abs(dy) }, warpDistances = {
20
- x: Math.min(absDiffs.x, canvasSize.width - absDiffs.x),
21
- y: Math.min(absDiffs.y, canvasSize.height - absDiffs.y),
22
- };
23
- return Math.hypot(warpDistances.x, warpDistances.y);
24
- }
25
- class Linker extends plugin_interactivity_1.ParticlesInteractorBase {
26
- _engine;
27
- _maxDistance;
28
- constructor(container, engine) {
29
- super(container);
30
- this._engine = engine;
31
- this._maxDistance = 0;
32
- }
33
- get maxDistance() {
34
- return this._maxDistance;
35
- }
36
- clear() {
37
- }
38
- init() {
39
- this.container.particles.linksColor = undefined;
40
- this.container.particles.linksColors = new Map();
41
- }
42
- interact(p1) {
43
- if (!p1.options.links) {
44
- return;
45
- }
46
- p1.links = [];
47
- if (p1.linksDistance && p1.linksDistance > this._maxDistance) {
48
- this._maxDistance = p1.linksDistance;
49
- }
50
- const pos1 = p1.getPosition(), container = this.container, canvasSize = container.canvas.size;
51
- if (pos1.x < engine_1.originPoint.x || pos1.y < engine_1.originPoint.y || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {
52
- return;
53
- }
54
- const linkOpt1 = p1.options.links, optOpacity = linkOpt1.opacity, optDistance = p1.retina.linksDistance ?? minDistance, warp = linkOpt1.warp, range = warp ? new CircleWarp_js_1.CircleWarp(pos1.x, pos1.y, optDistance, canvasSize) : new engine_1.Circle(pos1.x, pos1.y, optDistance), query = container.particles.grid.query(range);
55
- for (const p2 of query) {
56
- const linkOpt2 = p2.options.links;
57
- if (p1 === p2 ||
58
- !linkOpt2?.enable ||
59
- linkOpt1.id !== linkOpt2.id ||
60
- p2.spawning ||
61
- p2.destroyed ||
62
- !p2.links ||
63
- p1.links.some(t => t.destination === p2) ||
64
- p2.links.some(t => t.destination === p1)) {
65
- continue;
66
- }
67
- const pos2 = p2.getPosition();
68
- if (pos2.x < engine_1.originPoint.x || pos2.y < engine_1.originPoint.y || pos2.x > canvasSize.width || pos2.y > canvasSize.height) {
69
- continue;
70
- }
71
- const distDirect = (0, engine_1.getDistances)(pos1, pos2).distance, distWarp = warp && linkOpt2.warp ? getWarpDistance(pos1, pos2, canvasSize) : distDirect, distance = Math.min(distDirect, distWarp);
72
- if (distance > optDistance) {
73
- continue;
74
- }
75
- const opacityLine = (opacityOffset - distance / optDistance) * optOpacity;
76
- this._setColor(p1);
77
- p1.links.push({
78
- destination: p2,
79
- opacity: opacityLine,
80
- color: this._getLinkColor(p1, p2),
81
- isWarped: distWarp < distDirect,
82
- });
83
- }
84
- }
85
- isEnabled(particle) {
86
- return !!particle.options.links?.enable;
87
- }
88
- loadParticlesOptions(options, ...sources) {
89
- options.links ??= new Links_js_1.Links();
90
- for (const source of sources) {
91
- options.links.load(source?.links);
92
- }
93
- }
94
- reset() {
95
- }
96
- _getLinkColor(p1, p2) {
97
- const container = this.container, linksOptions = p1.options.links;
98
- if (!linksOptions) {
99
- return;
100
- }
101
- const linkColor = linksOptions.id !== undefined
102
- ? container.particles.linksColors.get(linksOptions.id)
103
- : container.particles.linksColor;
104
- return (0, engine_1.getLinkColor)(p1, p2, linkColor);
105
- }
106
- _setColor(p1) {
107
- if (!p1.options.links) {
108
- return;
109
- }
110
- const container = this.container, linksOptions = p1.options.links;
111
- let linkColor = linksOptions.id === undefined
112
- ? container.particles.linksColor
113
- : container.particles.linksColors.get(linksOptions.id);
114
- if (linkColor) {
115
- return;
116
- }
117
- linkColor = (0, engine_1.getLinkRandomColor)(this._engine, linksOptions.color, linksOptions.blink, linksOptions.consent);
118
- if (linksOptions.id === undefined) {
119
- container.particles.linksColor = linkColor;
120
- }
121
- else {
122
- container.particles.linksColors.set(linksOptions.id, linkColor);
123
- }
124
- }
125
- }
126
- exports.Linker = Linker;
127
- });
@@ -1,64 +0,0 @@
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
- })();
34
- (function (factory) {
35
- if (typeof module === "object" && typeof module.exports === "object") {
36
- var v = factory(require, exports);
37
- if (v !== undefined) module.exports = v;
38
- }
39
- else if (typeof define === "function" && define.amd) {
40
- define(["require", "exports"], factory);
41
- }
42
- })(function (require, exports) {
43
- "use strict";
44
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.LinksPlugin = void 0;
47
- class LinksPlugin {
48
- id = "links";
49
- _engine;
50
- constructor(engine) {
51
- this._engine = engine;
52
- }
53
- async getPlugin(container) {
54
- const { LinkInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./LinkInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./LinkInstance.js"], resolve_1, reject_1); }).then(__importStar));
55
- return new LinkInstance(container, this._engine);
56
- }
57
- loadOptions() {
58
- }
59
- needsPlugin() {
60
- return true;
61
- }
62
- }
63
- exports.LinksPlugin = LinksPlugin;
64
- });