UNPKG

react-sigma

Version:

Lightweight but powerful library for drawing network graphs built on top of SigmaJS

1 lines 2.91 kB
var Sigma=function(e){var n={};function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var a in e)t.d(r,a,function(n){return e[n]}.bind(null,a));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=370)}({370:function(e,n){(function(){(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins");var e=0,n={};function t(e){if(n[e])return n[e];var t=[0,0,0];return e.match(/^#/)?t=3===(e=(e||"").replace(/^#/,"")).length?[parseInt(e.charAt(0)+e.charAt(0),16),parseInt(e.charAt(1)+e.charAt(1),16),parseInt(e.charAt(2)+e.charAt(2),16)]:[parseInt(e.charAt(0)+e.charAt(1),16),parseInt(e.charAt(2)+e.charAt(3),16),parseInt(e.charAt(4)+e.charAt(5),16)]:e.match(/^ *rgba? *\(/)&&(t=[+(e=e.match(/^ *rgba? *\( *([0-9]*) *, *([0-9]*) *, *([0-9]*) *(,.*)?\) *$/))[1],+e[2],+e[3]]),n[e]={r:t[0],g:t[1],b:t[2]},n[e]}function r(e,n,r){return e=t(e),n=t(n),"rgb("+[0|e.r*(1-r)+n.r*r,0|e.g*(1-r)+n.g*r,0|e.b*(1-r)+n.b*r].join(",")+")"}sigma.plugins.animate=function(n,t,a){var i,o,s,c=a||{},u=++e,f=c.duration||n.settings("animationsTime"),l="string"==typeof c.easing?sigma.utils.easings[c.easing]:"function"==typeof c.easing?c.easing:sigma.utils.easings.quadraticInOut,d=sigma.utils.dateNow();for(s in i=c.nodes&&c.nodes.length?"object"==typeof c.nodes[0]?c.nodes:n.graph.nodes(c.nodes):n.graph.nodes(),o=i.reduce((function(e,n){var r;for(r in e[n.id]={},t)r in n&&(e[n.id][r]=n[r]);return e}),{}),n.animations=n.animations||Object.create({}),sigma.plugins.kill(n),n.cameras)n.cameras[s].edgequadtree._enabled=!1;!function e(){var a=(sigma.utils.dateNow()-d)/f;if(a>=1){var s;for(s in i.forEach((function(e){for(var n in t)n in t&&(e[n]=e[t[n]])})),n.cameras)n.cameras[s].edgequadtree._enabled=!0;n.refresh(),"function"==typeof c.onComplete&&c.onComplete()}else a=l(a),i.forEach((function(e){for(var n in t)n in t&&(n.match(/color$/)?e[n]=r(o[e.id][n],e[t[n]],a):e[n]=e[t[n]]*a+o[e.id][n]*(1-a))})),n.refresh(),n.animations[u]=requestAnimationFrame(e)}()},sigma.plugins.kill=function(e){for(var n in e.animations||{})cancelAnimationFrame(e.animations[n]);for(n in e.cameras)e.cameras[n].edgequadtree._enabled=!0}}).call(window)}).call(window)}});