feat: Phase 1 — extract the client (web SPA + desktop) to dtoro/oikos-web
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

Problem: the hexagonal refactor churns the backend tree for nine more
phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper,
compose/web image) must move to its own repo first so doc/layout
rewrites land once on a backend-only tree.

Change:
- New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/
  (updateURL repointed to oikos-web releases), compose/, own CI (web +
  desktop jobs), own deploy script (CI-green gate, TOCTOU guard,
  version-tagged images, prune-to-3), own webhook receiver on :9798 +
  launchd unit, own compose project publishing the same 8091:80.
- Cutover executed on mac-mini in order: oikos stack's web service
  stopped+removed, oikos-web project brought up on 8091; outer Caddy
  untouched (targets the published port) — serving + Authentik flow +
  /wails 404 quirk verified post-cutover.
- Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI
  workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install
  targets, the compose web service, oikos-web from deploy.sh's fallback
  prune list; wails + go-keyring dropped from go.mod, vendor synced.
- README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now
  point at the new repo; mbse + mascot design docs carry a path note.

Risk: production SPA serving depends on the new pipeline now; rollback
is versioned-image re-up of the old web service from a pre-split
checkout (port 8091). Desktop builds installed before the split still
check dtoro/oikos releases — one manual reinstall, noted in the
oikos-web release notes.

Verification: go vet, make test (race), make generate-check, golangci
(no new findings; baseline down 400→365); post-cutover curls —
localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
This commit is contained in:
2026-08-15 22:27:52 +02:00
parent e074f04bdf
commit d4d99a7473
18854 changed files with 2615729 additions and 173735 deletions

346
web/node_modules/sigma/dist/colors-beb06eb2.esm.js generated vendored Normal file
View File

@@ -0,0 +1,346 @@
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
var HTML_COLORS = {
black: "#000000",
silver: "#C0C0C0",
gray: "#808080",
grey: "#808080",
white: "#FFFFFF",
maroon: "#800000",
red: "#FF0000",
purple: "#800080",
fuchsia: "#FF00FF",
green: "#008000",
lime: "#00FF00",
olive: "#808000",
yellow: "#FFFF00",
navy: "#000080",
blue: "#0000FF",
teal: "#008080",
aqua: "#00FFFF",
darkblue: "#00008B",
mediumblue: "#0000CD",
darkgreen: "#006400",
darkcyan: "#008B8B",
deepskyblue: "#00BFFF",
darkturquoise: "#00CED1",
mediumspringgreen: "#00FA9A",
springgreen: "#00FF7F",
cyan: "#00FFFF",
midnightblue: "#191970",
dodgerblue: "#1E90FF",
lightseagreen: "#20B2AA",
forestgreen: "#228B22",
seagreen: "#2E8B57",
darkslategray: "#2F4F4F",
darkslategrey: "#2F4F4F",
limegreen: "#32CD32",
mediumseagreen: "#3CB371",
turquoise: "#40E0D0",
royalblue: "#4169E1",
steelblue: "#4682B4",
darkslateblue: "#483D8B",
mediumturquoise: "#48D1CC",
indigo: "#4B0082",
darkolivegreen: "#556B2F",
cadetblue: "#5F9EA0",
cornflowerblue: "#6495ED",
rebeccapurple: "#663399",
mediumaquamarine: "#66CDAA",
dimgray: "#696969",
dimgrey: "#696969",
slateblue: "#6A5ACD",
olivedrab: "#6B8E23",
slategray: "#708090",
slategrey: "#708090",
lightslategray: "#778899",
lightslategrey: "#778899",
mediumslateblue: "#7B68EE",
lawngreen: "#7CFC00",
chartreuse: "#7FFF00",
aquamarine: "#7FFFD4",
skyblue: "#87CEEB",
lightskyblue: "#87CEFA",
blueviolet: "#8A2BE2",
darkred: "#8B0000",
darkmagenta: "#8B008B",
saddlebrown: "#8B4513",
darkseagreen: "#8FBC8F",
lightgreen: "#90EE90",
mediumpurple: "#9370DB",
darkviolet: "#9400D3",
palegreen: "#98FB98",
darkorchid: "#9932CC",
yellowgreen: "#9ACD32",
sienna: "#A0522D",
brown: "#A52A2A",
darkgray: "#A9A9A9",
darkgrey: "#A9A9A9",
lightblue: "#ADD8E6",
greenyellow: "#ADFF2F",
paleturquoise: "#AFEEEE",
lightsteelblue: "#B0C4DE",
powderblue: "#B0E0E6",
firebrick: "#B22222",
darkgoldenrod: "#B8860B",
mediumorchid: "#BA55D3",
rosybrown: "#BC8F8F",
darkkhaki: "#BDB76B",
mediumvioletred: "#C71585",
indianred: "#CD5C5C",
peru: "#CD853F",
chocolate: "#D2691E",
tan: "#D2B48C",
lightgray: "#D3D3D3",
lightgrey: "#D3D3D3",
thistle: "#D8BFD8",
orchid: "#DA70D6",
goldenrod: "#DAA520",
palevioletred: "#DB7093",
crimson: "#DC143C",
gainsboro: "#DCDCDC",
plum: "#DDA0DD",
burlywood: "#DEB887",
lightcyan: "#E0FFFF",
lavender: "#E6E6FA",
darksalmon: "#E9967A",
violet: "#EE82EE",
palegoldenrod: "#EEE8AA",
lightcoral: "#F08080",
khaki: "#F0E68C",
aliceblue: "#F0F8FF",
honeydew: "#F0FFF0",
azure: "#F0FFFF",
sandybrown: "#F4A460",
wheat: "#F5DEB3",
beige: "#F5F5DC",
whitesmoke: "#F5F5F5",
mintcream: "#F5FFFA",
ghostwhite: "#F8F8FF",
salmon: "#FA8072",
antiquewhite: "#FAEBD7",
linen: "#FAF0E6",
lightgoldenrodyellow: "#FAFAD2",
oldlace: "#FDF5E6",
magenta: "#FF00FF",
deeppink: "#FF1493",
orangered: "#FF4500",
tomato: "#FF6347",
hotpink: "#FF69B4",
coral: "#FF7F50",
darkorange: "#FF8C00",
lightsalmon: "#FFA07A",
orange: "#FFA500",
lightpink: "#FFB6C1",
pink: "#FFC0CB",
gold: "#FFD700",
peachpuff: "#FFDAB9",
navajowhite: "#FFDEAD",
moccasin: "#FFE4B5",
bisque: "#FFE4C4",
mistyrose: "#FFE4E1",
blanchedalmond: "#FFEBCD",
papayawhip: "#FFEFD5",
lavenderblush: "#FFF0F5",
seashell: "#FFF5EE",
cornsilk: "#FFF8DC",
lemonchiffon: "#FFFACD",
floralwhite: "#FFFAF0",
snow: "#FFFAFA",
lightyellow: "#FFFFE0",
ivory: "#FFFFF0"
};
/**
* Function extracting the color at the given pixel.
*/
function extractPixel(gl, x, y, array) {
var data = array || new Uint8Array(4);
gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, data);
return data;
}
/**
* Memoized function returning a float-encoded color from various string
* formats describing colors.
*/
var INT8 = new Int8Array(4);
var INT32 = new Int32Array(INT8.buffer, 0, 1);
var FLOAT32 = new Float32Array(INT8.buffer, 0, 1);
var RGBA_TEST_REGEX = /^\s*rgba?\s*\(/;
var RGBA_EXTRACT_REGEX = /^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;
function parseColor(val) {
var r = 0; // byte
var g = 0; // byte
var b = 0; // byte
var a = 1; // float
// Handling hexadecimal notation
if (val[0] === "#") {
if (val.length === 4) {
r = parseInt(val.charAt(1) + val.charAt(1), 16);
g = parseInt(val.charAt(2) + val.charAt(2), 16);
b = parseInt(val.charAt(3) + val.charAt(3), 16);
} else {
r = parseInt(val.charAt(1) + val.charAt(2), 16);
g = parseInt(val.charAt(3) + val.charAt(4), 16);
b = parseInt(val.charAt(5) + val.charAt(6), 16);
}
if (val.length === 9) {
a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255;
}
}
// Handling rgb notation
else if (RGBA_TEST_REGEX.test(val)) {
var match = val.match(RGBA_EXTRACT_REGEX);
if (match) {
r = +match[1];
g = +match[2];
b = +match[3];
if (match[4]) a = +match[4];
}
}
return {
r: r,
g: g,
b: b,
a: a
};
}
var FLOAT_COLOR_CACHE = {};
for (var htmlColor in HTML_COLORS) {
FLOAT_COLOR_CACHE[htmlColor] = floatColor(HTML_COLORS[htmlColor]);
// Replicating cache for hex values for free
FLOAT_COLOR_CACHE[HTML_COLORS[htmlColor]] = FLOAT_COLOR_CACHE[htmlColor];
}
function rgbaToFloat(r, g, b, a, masking) {
INT32[0] = a << 24 | b << 16 | g << 8 | r;
if (masking) INT32[0] = INT32[0] & 0xfeffffff;
return FLOAT32[0];
}
function floatColor(val) {
// The html color names are case-insensitive
val = val.toLowerCase();
// If the color is already computed, we yield it
if (typeof FLOAT_COLOR_CACHE[val] !== "undefined") return FLOAT_COLOR_CACHE[val];
var parsed = parseColor(val);
var r = parsed.r,
g = parsed.g,
b = parsed.b;
var a = parsed.a;
a = a * 255 | 0;
var color = rgbaToFloat(r, g, b, a, true);
FLOAT_COLOR_CACHE[val] = color;
return color;
}
function colorToArray(val, masking) {
FLOAT32[0] = floatColor(val);
var intValue = INT32[0];
if (masking) {
intValue = intValue | 0x01000000;
}
var r = intValue & 0xff;
var g = intValue >> 8 & 0xff;
var b = intValue >> 16 & 0xff;
var a = intValue >> 24 & 0xff;
return [r, g, b, a];
}
var FLOAT_INDEX_CACHE = {};
function indexToColor(index) {
// If the index is already computed, we yield it
if (typeof FLOAT_INDEX_CACHE[index] !== "undefined") return FLOAT_INDEX_CACHE[index];
// To address issue #1397, one strategy is to keep encoding 4 bytes colors,
// but with alpha hard-set to 1.0 (or 255):
var r = (index & 0x00ff0000) >>> 16;
var g = (index & 0x0000ff00) >>> 8;
var b = index & 0x000000ff;
var a = 0x000000ff;
// The original 4 bytes color encoding was the following:
// const r = (index & 0xff000000) >>> 24;
// const g = (index & 0x00ff0000) >>> 16;
// const b = (index & 0x0000ff00) >>> 8;
// const a = index & 0x000000ff;
var color = rgbaToFloat(r, g, b, a, true);
FLOAT_INDEX_CACHE[index] = color;
return color;
}
function colorToIndex(r, g, b, _a) {
// As for the function indexToColor, because of #1397 and the "alpha is always
// 1.0" strategy, we need to fix this function as well:
return b + (g << 8) + (r << 16);
// The original 4 bytes color decoding is the following:
// return a + (b << 8) + (g << 16) + (r << 24);
}
function getPixelColor(gl, frameBuffer, x, y, pixelRatio, downSizingRatio) {
var bufferX = Math.floor(x / downSizingRatio * pixelRatio);
var bufferY = Math.floor(gl.drawingBufferHeight / downSizingRatio - y / downSizingRatio * pixelRatio);
var pixel = new Uint8Array(4);
gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);
gl.readPixels(bufferX, bufferY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
var _pixel = _slicedToArray(pixel, 4),
r = _pixel[0],
g = _pixel[1],
b = _pixel[2],
a = _pixel[3];
return [r, g, b, a];
}
export { HTML_COLORS as H, _slicedToArray as _, _arrayLikeToArray as a, _unsupportedIterableToArray as b, colorToIndex as c, colorToArray as d, extractPixel as e, floatColor as f, getPixelColor as g, indexToColor as i, parseColor as p, rgbaToFloat as r };

359
web/node_modules/sigma/dist/colors-ee2e2828.cjs.prod.js generated vendored Normal file
View File

@@ -0,0 +1,359 @@
'use strict';
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
var HTML_COLORS = {
black: "#000000",
silver: "#C0C0C0",
gray: "#808080",
grey: "#808080",
white: "#FFFFFF",
maroon: "#800000",
red: "#FF0000",
purple: "#800080",
fuchsia: "#FF00FF",
green: "#008000",
lime: "#00FF00",
olive: "#808000",
yellow: "#FFFF00",
navy: "#000080",
blue: "#0000FF",
teal: "#008080",
aqua: "#00FFFF",
darkblue: "#00008B",
mediumblue: "#0000CD",
darkgreen: "#006400",
darkcyan: "#008B8B",
deepskyblue: "#00BFFF",
darkturquoise: "#00CED1",
mediumspringgreen: "#00FA9A",
springgreen: "#00FF7F",
cyan: "#00FFFF",
midnightblue: "#191970",
dodgerblue: "#1E90FF",
lightseagreen: "#20B2AA",
forestgreen: "#228B22",
seagreen: "#2E8B57",
darkslategray: "#2F4F4F",
darkslategrey: "#2F4F4F",
limegreen: "#32CD32",
mediumseagreen: "#3CB371",
turquoise: "#40E0D0",
royalblue: "#4169E1",
steelblue: "#4682B4",
darkslateblue: "#483D8B",
mediumturquoise: "#48D1CC",
indigo: "#4B0082",
darkolivegreen: "#556B2F",
cadetblue: "#5F9EA0",
cornflowerblue: "#6495ED",
rebeccapurple: "#663399",
mediumaquamarine: "#66CDAA",
dimgray: "#696969",
dimgrey: "#696969",
slateblue: "#6A5ACD",
olivedrab: "#6B8E23",
slategray: "#708090",
slategrey: "#708090",
lightslategray: "#778899",
lightslategrey: "#778899",
mediumslateblue: "#7B68EE",
lawngreen: "#7CFC00",
chartreuse: "#7FFF00",
aquamarine: "#7FFFD4",
skyblue: "#87CEEB",
lightskyblue: "#87CEFA",
blueviolet: "#8A2BE2",
darkred: "#8B0000",
darkmagenta: "#8B008B",
saddlebrown: "#8B4513",
darkseagreen: "#8FBC8F",
lightgreen: "#90EE90",
mediumpurple: "#9370DB",
darkviolet: "#9400D3",
palegreen: "#98FB98",
darkorchid: "#9932CC",
yellowgreen: "#9ACD32",
sienna: "#A0522D",
brown: "#A52A2A",
darkgray: "#A9A9A9",
darkgrey: "#A9A9A9",
lightblue: "#ADD8E6",
greenyellow: "#ADFF2F",
paleturquoise: "#AFEEEE",
lightsteelblue: "#B0C4DE",
powderblue: "#B0E0E6",
firebrick: "#B22222",
darkgoldenrod: "#B8860B",
mediumorchid: "#BA55D3",
rosybrown: "#BC8F8F",
darkkhaki: "#BDB76B",
mediumvioletred: "#C71585",
indianred: "#CD5C5C",
peru: "#CD853F",
chocolate: "#D2691E",
tan: "#D2B48C",
lightgray: "#D3D3D3",
lightgrey: "#D3D3D3",
thistle: "#D8BFD8",
orchid: "#DA70D6",
goldenrod: "#DAA520",
palevioletred: "#DB7093",
crimson: "#DC143C",
gainsboro: "#DCDCDC",
plum: "#DDA0DD",
burlywood: "#DEB887",
lightcyan: "#E0FFFF",
lavender: "#E6E6FA",
darksalmon: "#E9967A",
violet: "#EE82EE",
palegoldenrod: "#EEE8AA",
lightcoral: "#F08080",
khaki: "#F0E68C",
aliceblue: "#F0F8FF",
honeydew: "#F0FFF0",
azure: "#F0FFFF",
sandybrown: "#F4A460",
wheat: "#F5DEB3",
beige: "#F5F5DC",
whitesmoke: "#F5F5F5",
mintcream: "#F5FFFA",
ghostwhite: "#F8F8FF",
salmon: "#FA8072",
antiquewhite: "#FAEBD7",
linen: "#FAF0E6",
lightgoldenrodyellow: "#FAFAD2",
oldlace: "#FDF5E6",
magenta: "#FF00FF",
deeppink: "#FF1493",
orangered: "#FF4500",
tomato: "#FF6347",
hotpink: "#FF69B4",
coral: "#FF7F50",
darkorange: "#FF8C00",
lightsalmon: "#FFA07A",
orange: "#FFA500",
lightpink: "#FFB6C1",
pink: "#FFC0CB",
gold: "#FFD700",
peachpuff: "#FFDAB9",
navajowhite: "#FFDEAD",
moccasin: "#FFE4B5",
bisque: "#FFE4C4",
mistyrose: "#FFE4E1",
blanchedalmond: "#FFEBCD",
papayawhip: "#FFEFD5",
lavenderblush: "#FFF0F5",
seashell: "#FFF5EE",
cornsilk: "#FFF8DC",
lemonchiffon: "#FFFACD",
floralwhite: "#FFFAF0",
snow: "#FFFAFA",
lightyellow: "#FFFFE0",
ivory: "#FFFFF0"
};
/**
* Function extracting the color at the given pixel.
*/
function extractPixel(gl, x, y, array) {
var data = array || new Uint8Array(4);
gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, data);
return data;
}
/**
* Memoized function returning a float-encoded color from various string
* formats describing colors.
*/
var INT8 = new Int8Array(4);
var INT32 = new Int32Array(INT8.buffer, 0, 1);
var FLOAT32 = new Float32Array(INT8.buffer, 0, 1);
var RGBA_TEST_REGEX = /^\s*rgba?\s*\(/;
var RGBA_EXTRACT_REGEX = /^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;
function parseColor(val) {
var r = 0; // byte
var g = 0; // byte
var b = 0; // byte
var a = 1; // float
// Handling hexadecimal notation
if (val[0] === "#") {
if (val.length === 4) {
r = parseInt(val.charAt(1) + val.charAt(1), 16);
g = parseInt(val.charAt(2) + val.charAt(2), 16);
b = parseInt(val.charAt(3) + val.charAt(3), 16);
} else {
r = parseInt(val.charAt(1) + val.charAt(2), 16);
g = parseInt(val.charAt(3) + val.charAt(4), 16);
b = parseInt(val.charAt(5) + val.charAt(6), 16);
}
if (val.length === 9) {
a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255;
}
}
// Handling rgb notation
else if (RGBA_TEST_REGEX.test(val)) {
var match = val.match(RGBA_EXTRACT_REGEX);
if (match) {
r = +match[1];
g = +match[2];
b = +match[3];
if (match[4]) a = +match[4];
}
}
return {
r: r,
g: g,
b: b,
a: a
};
}
var FLOAT_COLOR_CACHE = {};
for (var htmlColor in HTML_COLORS) {
FLOAT_COLOR_CACHE[htmlColor] = floatColor(HTML_COLORS[htmlColor]);
// Replicating cache for hex values for free
FLOAT_COLOR_CACHE[HTML_COLORS[htmlColor]] = FLOAT_COLOR_CACHE[htmlColor];
}
function rgbaToFloat(r, g, b, a, masking) {
INT32[0] = a << 24 | b << 16 | g << 8 | r;
if (masking) INT32[0] = INT32[0] & 0xfeffffff;
return FLOAT32[0];
}
function floatColor(val) {
// The html color names are case-insensitive
val = val.toLowerCase();
// If the color is already computed, we yield it
if (typeof FLOAT_COLOR_CACHE[val] !== "undefined") return FLOAT_COLOR_CACHE[val];
var parsed = parseColor(val);
var r = parsed.r,
g = parsed.g,
b = parsed.b;
var a = parsed.a;
a = a * 255 | 0;
var color = rgbaToFloat(r, g, b, a, true);
FLOAT_COLOR_CACHE[val] = color;
return color;
}
function colorToArray(val, masking) {
FLOAT32[0] = floatColor(val);
var intValue = INT32[0];
if (masking) {
intValue = intValue | 0x01000000;
}
var r = intValue & 0xff;
var g = intValue >> 8 & 0xff;
var b = intValue >> 16 & 0xff;
var a = intValue >> 24 & 0xff;
return [r, g, b, a];
}
var FLOAT_INDEX_CACHE = {};
function indexToColor(index) {
// If the index is already computed, we yield it
if (typeof FLOAT_INDEX_CACHE[index] !== "undefined") return FLOAT_INDEX_CACHE[index];
// To address issue #1397, one strategy is to keep encoding 4 bytes colors,
// but with alpha hard-set to 1.0 (or 255):
var r = (index & 0x00ff0000) >>> 16;
var g = (index & 0x0000ff00) >>> 8;
var b = index & 0x000000ff;
var a = 0x000000ff;
// The original 4 bytes color encoding was the following:
// const r = (index & 0xff000000) >>> 24;
// const g = (index & 0x00ff0000) >>> 16;
// const b = (index & 0x0000ff00) >>> 8;
// const a = index & 0x000000ff;
var color = rgbaToFloat(r, g, b, a, true);
FLOAT_INDEX_CACHE[index] = color;
return color;
}
function colorToIndex(r, g, b, _a) {
// As for the function indexToColor, because of #1397 and the "alpha is always
// 1.0" strategy, we need to fix this function as well:
return b + (g << 8) + (r << 16);
// The original 4 bytes color decoding is the following:
// return a + (b << 8) + (g << 16) + (r << 24);
}
function getPixelColor(gl, frameBuffer, x, y, pixelRatio, downSizingRatio) {
var bufferX = Math.floor(x / downSizingRatio * pixelRatio);
var bufferY = Math.floor(gl.drawingBufferHeight / downSizingRatio - y / downSizingRatio * pixelRatio);
var pixel = new Uint8Array(4);
gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);
gl.readPixels(bufferX, bufferY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
var _pixel = _slicedToArray(pixel, 4),
r = _pixel[0],
g = _pixel[1],
b = _pixel[2],
a = _pixel[3];
return [r, g, b, a];
}
exports.HTML_COLORS = HTML_COLORS;
exports._arrayLikeToArray = _arrayLikeToArray;
exports._slicedToArray = _slicedToArray;
exports._unsupportedIterableToArray = _unsupportedIterableToArray;
exports.colorToArray = colorToArray;
exports.colorToIndex = colorToIndex;
exports.extractPixel = extractPixel;
exports.floatColor = floatColor;
exports.getPixelColor = getPixelColor;
exports.indexToColor = indexToColor;
exports.parseColor = parseColor;
exports.rgbaToFloat = rgbaToFloat;

359
web/node_modules/sigma/dist/colors-fe6de9d2.cjs.dev.js generated vendored Normal file
View File

@@ -0,0 +1,359 @@
'use strict';
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
var HTML_COLORS = {
black: "#000000",
silver: "#C0C0C0",
gray: "#808080",
grey: "#808080",
white: "#FFFFFF",
maroon: "#800000",
red: "#FF0000",
purple: "#800080",
fuchsia: "#FF00FF",
green: "#008000",
lime: "#00FF00",
olive: "#808000",
yellow: "#FFFF00",
navy: "#000080",
blue: "#0000FF",
teal: "#008080",
aqua: "#00FFFF",
darkblue: "#00008B",
mediumblue: "#0000CD",
darkgreen: "#006400",
darkcyan: "#008B8B",
deepskyblue: "#00BFFF",
darkturquoise: "#00CED1",
mediumspringgreen: "#00FA9A",
springgreen: "#00FF7F",
cyan: "#00FFFF",
midnightblue: "#191970",
dodgerblue: "#1E90FF",
lightseagreen: "#20B2AA",
forestgreen: "#228B22",
seagreen: "#2E8B57",
darkslategray: "#2F4F4F",
darkslategrey: "#2F4F4F",
limegreen: "#32CD32",
mediumseagreen: "#3CB371",
turquoise: "#40E0D0",
royalblue: "#4169E1",
steelblue: "#4682B4",
darkslateblue: "#483D8B",
mediumturquoise: "#48D1CC",
indigo: "#4B0082",
darkolivegreen: "#556B2F",
cadetblue: "#5F9EA0",
cornflowerblue: "#6495ED",
rebeccapurple: "#663399",
mediumaquamarine: "#66CDAA",
dimgray: "#696969",
dimgrey: "#696969",
slateblue: "#6A5ACD",
olivedrab: "#6B8E23",
slategray: "#708090",
slategrey: "#708090",
lightslategray: "#778899",
lightslategrey: "#778899",
mediumslateblue: "#7B68EE",
lawngreen: "#7CFC00",
chartreuse: "#7FFF00",
aquamarine: "#7FFFD4",
skyblue: "#87CEEB",
lightskyblue: "#87CEFA",
blueviolet: "#8A2BE2",
darkred: "#8B0000",
darkmagenta: "#8B008B",
saddlebrown: "#8B4513",
darkseagreen: "#8FBC8F",
lightgreen: "#90EE90",
mediumpurple: "#9370DB",
darkviolet: "#9400D3",
palegreen: "#98FB98",
darkorchid: "#9932CC",
yellowgreen: "#9ACD32",
sienna: "#A0522D",
brown: "#A52A2A",
darkgray: "#A9A9A9",
darkgrey: "#A9A9A9",
lightblue: "#ADD8E6",
greenyellow: "#ADFF2F",
paleturquoise: "#AFEEEE",
lightsteelblue: "#B0C4DE",
powderblue: "#B0E0E6",
firebrick: "#B22222",
darkgoldenrod: "#B8860B",
mediumorchid: "#BA55D3",
rosybrown: "#BC8F8F",
darkkhaki: "#BDB76B",
mediumvioletred: "#C71585",
indianred: "#CD5C5C",
peru: "#CD853F",
chocolate: "#D2691E",
tan: "#D2B48C",
lightgray: "#D3D3D3",
lightgrey: "#D3D3D3",
thistle: "#D8BFD8",
orchid: "#DA70D6",
goldenrod: "#DAA520",
palevioletred: "#DB7093",
crimson: "#DC143C",
gainsboro: "#DCDCDC",
plum: "#DDA0DD",
burlywood: "#DEB887",
lightcyan: "#E0FFFF",
lavender: "#E6E6FA",
darksalmon: "#E9967A",
violet: "#EE82EE",
palegoldenrod: "#EEE8AA",
lightcoral: "#F08080",
khaki: "#F0E68C",
aliceblue: "#F0F8FF",
honeydew: "#F0FFF0",
azure: "#F0FFFF",
sandybrown: "#F4A460",
wheat: "#F5DEB3",
beige: "#F5F5DC",
whitesmoke: "#F5F5F5",
mintcream: "#F5FFFA",
ghostwhite: "#F8F8FF",
salmon: "#FA8072",
antiquewhite: "#FAEBD7",
linen: "#FAF0E6",
lightgoldenrodyellow: "#FAFAD2",
oldlace: "#FDF5E6",
magenta: "#FF00FF",
deeppink: "#FF1493",
orangered: "#FF4500",
tomato: "#FF6347",
hotpink: "#FF69B4",
coral: "#FF7F50",
darkorange: "#FF8C00",
lightsalmon: "#FFA07A",
orange: "#FFA500",
lightpink: "#FFB6C1",
pink: "#FFC0CB",
gold: "#FFD700",
peachpuff: "#FFDAB9",
navajowhite: "#FFDEAD",
moccasin: "#FFE4B5",
bisque: "#FFE4C4",
mistyrose: "#FFE4E1",
blanchedalmond: "#FFEBCD",
papayawhip: "#FFEFD5",
lavenderblush: "#FFF0F5",
seashell: "#FFF5EE",
cornsilk: "#FFF8DC",
lemonchiffon: "#FFFACD",
floralwhite: "#FFFAF0",
snow: "#FFFAFA",
lightyellow: "#FFFFE0",
ivory: "#FFFFF0"
};
/**
* Function extracting the color at the given pixel.
*/
function extractPixel(gl, x, y, array) {
var data = array || new Uint8Array(4);
gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, data);
return data;
}
/**
* Memoized function returning a float-encoded color from various string
* formats describing colors.
*/
var INT8 = new Int8Array(4);
var INT32 = new Int32Array(INT8.buffer, 0, 1);
var FLOAT32 = new Float32Array(INT8.buffer, 0, 1);
var RGBA_TEST_REGEX = /^\s*rgba?\s*\(/;
var RGBA_EXTRACT_REGEX = /^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;
function parseColor(val) {
var r = 0; // byte
var g = 0; // byte
var b = 0; // byte
var a = 1; // float
// Handling hexadecimal notation
if (val[0] === "#") {
if (val.length === 4) {
r = parseInt(val.charAt(1) + val.charAt(1), 16);
g = parseInt(val.charAt(2) + val.charAt(2), 16);
b = parseInt(val.charAt(3) + val.charAt(3), 16);
} else {
r = parseInt(val.charAt(1) + val.charAt(2), 16);
g = parseInt(val.charAt(3) + val.charAt(4), 16);
b = parseInt(val.charAt(5) + val.charAt(6), 16);
}
if (val.length === 9) {
a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255;
}
}
// Handling rgb notation
else if (RGBA_TEST_REGEX.test(val)) {
var match = val.match(RGBA_EXTRACT_REGEX);
if (match) {
r = +match[1];
g = +match[2];
b = +match[3];
if (match[4]) a = +match[4];
}
}
return {
r: r,
g: g,
b: b,
a: a
};
}
var FLOAT_COLOR_CACHE = {};
for (var htmlColor in HTML_COLORS) {
FLOAT_COLOR_CACHE[htmlColor] = floatColor(HTML_COLORS[htmlColor]);
// Replicating cache for hex values for free
FLOAT_COLOR_CACHE[HTML_COLORS[htmlColor]] = FLOAT_COLOR_CACHE[htmlColor];
}
function rgbaToFloat(r, g, b, a, masking) {
INT32[0] = a << 24 | b << 16 | g << 8 | r;
if (masking) INT32[0] = INT32[0] & 0xfeffffff;
return FLOAT32[0];
}
function floatColor(val) {
// The html color names are case-insensitive
val = val.toLowerCase();
// If the color is already computed, we yield it
if (typeof FLOAT_COLOR_CACHE[val] !== "undefined") return FLOAT_COLOR_CACHE[val];
var parsed = parseColor(val);
var r = parsed.r,
g = parsed.g,
b = parsed.b;
var a = parsed.a;
a = a * 255 | 0;
var color = rgbaToFloat(r, g, b, a, true);
FLOAT_COLOR_CACHE[val] = color;
return color;
}
function colorToArray(val, masking) {
FLOAT32[0] = floatColor(val);
var intValue = INT32[0];
if (masking) {
intValue = intValue | 0x01000000;
}
var r = intValue & 0xff;
var g = intValue >> 8 & 0xff;
var b = intValue >> 16 & 0xff;
var a = intValue >> 24 & 0xff;
return [r, g, b, a];
}
var FLOAT_INDEX_CACHE = {};
function indexToColor(index) {
// If the index is already computed, we yield it
if (typeof FLOAT_INDEX_CACHE[index] !== "undefined") return FLOAT_INDEX_CACHE[index];
// To address issue #1397, one strategy is to keep encoding 4 bytes colors,
// but with alpha hard-set to 1.0 (or 255):
var r = (index & 0x00ff0000) >>> 16;
var g = (index & 0x0000ff00) >>> 8;
var b = index & 0x000000ff;
var a = 0x000000ff;
// The original 4 bytes color encoding was the following:
// const r = (index & 0xff000000) >>> 24;
// const g = (index & 0x00ff0000) >>> 16;
// const b = (index & 0x0000ff00) >>> 8;
// const a = index & 0x000000ff;
var color = rgbaToFloat(r, g, b, a, true);
FLOAT_INDEX_CACHE[index] = color;
return color;
}
function colorToIndex(r, g, b, _a) {
// As for the function indexToColor, because of #1397 and the "alpha is always
// 1.0" strategy, we need to fix this function as well:
return b + (g << 8) + (r << 16);
// The original 4 bytes color decoding is the following:
// return a + (b << 8) + (g << 16) + (r << 24);
}
function getPixelColor(gl, frameBuffer, x, y, pixelRatio, downSizingRatio) {
var bufferX = Math.floor(x / downSizingRatio * pixelRatio);
var bufferY = Math.floor(gl.drawingBufferHeight / downSizingRatio - y / downSizingRatio * pixelRatio);
var pixel = new Uint8Array(4);
gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);
gl.readPixels(bufferX, bufferY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
var _pixel = _slicedToArray(pixel, 4),
r = _pixel[0],
g = _pixel[1],
b = _pixel[2],
a = _pixel[3];
return [r, g, b, a];
}
exports.HTML_COLORS = HTML_COLORS;
exports._arrayLikeToArray = _arrayLikeToArray;
exports._slicedToArray = _slicedToArray;
exports._unsupportedIterableToArray = _unsupportedIterableToArray;
exports.colorToArray = colorToArray;
exports.colorToIndex = colorToIndex;
exports.extractPixel = extractPixel;
exports.floatColor = floatColor;
exports.getPixelColor = getPixelColor;
exports.indexToColor = indexToColor;
exports.parseColor = parseColor;
exports.rgbaToFloat = rgbaToFloat;

65
web/node_modules/sigma/dist/data-11df7124.esm.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
/**
* Extends the target array with the given values.
*/
function extend(array, values) {
var l2 = values.size;
if (l2 === 0) return;
var l1 = array.length;
array.length += l2;
var i = 0;
values.forEach(function (value) {
array[l1 + i] = value;
i++;
});
}
/**
* Checks whether the given value is a plain object.
*/
function isPlainObject(value) {
return _typeof(value) === "object" && value !== null && value.constructor === Object;
}
/**
* Helper to use `Object.assign` with more than two objects.
*/
function assign(target) {
target = target || {};
for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {
var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (!o) continue;
Object.assign(target, o);
}
return target;
}
/**
* Very simple recursive `Object.assign` like function.
*/
function assignDeep(target) {
target = target || {};
for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {
var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (!o) continue;
for (var k in o) {
if (isPlainObject(o[k])) {
target[k] = assignDeep(target[k], o[k]);
} else {
target[k] = o[k];
}
}
}
return target;
}
export { _typeof as _, assign as a, assignDeep as b, extend as e, isPlainObject as i };

71
web/node_modules/sigma/dist/data-24ae515b.cjs.dev.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
'use strict';
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
/**
* Extends the target array with the given values.
*/
function extend(array, values) {
var l2 = values.size;
if (l2 === 0) return;
var l1 = array.length;
array.length += l2;
var i = 0;
values.forEach(function (value) {
array[l1 + i] = value;
i++;
});
}
/**
* Checks whether the given value is a plain object.
*/
function isPlainObject(value) {
return _typeof(value) === "object" && value !== null && value.constructor === Object;
}
/**
* Helper to use `Object.assign` with more than two objects.
*/
function assign(target) {
target = target || {};
for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {
var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (!o) continue;
Object.assign(target, o);
}
return target;
}
/**
* Very simple recursive `Object.assign` like function.
*/
function assignDeep(target) {
target = target || {};
for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {
var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (!o) continue;
for (var k in o) {
if (isPlainObject(o[k])) {
target[k] = assignDeep(target[k], o[k]);
} else {
target[k] = o[k];
}
}
}
return target;
}
exports._typeof = _typeof;
exports.assign = assign;
exports.assignDeep = assignDeep;
exports.extend = extend;
exports.isPlainObject = isPlainObject;

71
web/node_modules/sigma/dist/data-881001cd.cjs.prod.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
'use strict';
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
/**
* Extends the target array with the given values.
*/
function extend(array, values) {
var l2 = values.size;
if (l2 === 0) return;
var l1 = array.length;
array.length += l2;
var i = 0;
values.forEach(function (value) {
array[l1 + i] = value;
i++;
});
}
/**
* Checks whether the given value is a plain object.
*/
function isPlainObject(value) {
return _typeof(value) === "object" && value !== null && value.constructor === Object;
}
/**
* Helper to use `Object.assign` with more than two objects.
*/
function assign(target) {
target = target || {};
for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {
var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (!o) continue;
Object.assign(target, o);
}
return target;
}
/**
* Very simple recursive `Object.assign` like function.
*/
function assignDeep(target) {
target = target || {};
for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {
var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (!o) continue;
for (var k in o) {
if (isPlainObject(o[k])) {
target[k] = assignDeep(target[k], o[k]);
} else {
target[k] = o[k];
}
}
}
return target;
}
exports._typeof = _typeof;
exports.assign = assign;
exports.assignDeep = assignDeep;
exports.extend = extend;
exports.isPlainObject = isPlainObject;

View File

@@ -0,0 +1,43 @@
import { CameraState, TypedEventEmitter } from "../types.js";
import { AnimateOptions } from "../utils/index.js";
export type CameraEvents = {
updated(state: CameraState): void;
};
export default class Camera extends TypedEventEmitter<CameraEvents> implements CameraState {
x: number;
y: number;
angle: number;
ratio: number;
minRatio: number | null;
maxRatio: number | null;
enabledZooming: boolean;
enabledPanning: boolean;
enabledRotation: boolean;
clean: ((state: CameraState) => CameraState) | null;
private nextFrame;
private previousState;
private enabled;
animationCallback?: () => void;
constructor();
static from(state: CameraState): Camera;
enable(): this;
disable(): this;
getState(): CameraState;
hasState(state: CameraState): boolean;
getPreviousState(): CameraState | null;
getBoundedRatio(ratio: number): number;
validateState(state: Partial<CameraState>): Partial<CameraState>;
isAnimated(): boolean;
setState(state: Partial<CameraState>): this;
updateState(updater: (state: CameraState) => Partial<CameraState>): this;
animate(state: Partial<CameraState>, opts: Partial<AnimateOptions>, callback: () => void): void;
animate(state: Partial<CameraState>, opts?: Partial<AnimateOptions>): Promise<void>;
animatedZoom(factorOrOptions?: number | (Partial<AnimateOptions> & {
factor?: number;
})): Promise<void>;
animatedUnzoom(factorOrOptions?: number | (Partial<AnimateOptions> & {
factor?: number;
})): Promise<void>;
animatedReset(options?: Partial<AnimateOptions>): Promise<void>;
copy(): Camera;
}

View File

@@ -0,0 +1,16 @@
import { Attributes } from "graphology-types";
import Sigma from "../../sigma.js";
import { Coordinates, EventsMapping, MouseCoords, TouchCoords, TypedEventEmitter, WheelCoords } from "../../types.js";
export declare function getPosition(e: MouseEvent | Touch, dom: HTMLElement): Coordinates;
export declare function getMouseCoords(e: MouseEvent, dom: HTMLElement): MouseCoords;
export declare function cleanMouseCoords(e: MouseCoords | TouchCoords): MouseCoords;
export declare function getWheelCoords(e: WheelEvent, dom: HTMLElement): WheelCoords;
export declare function getTouchesArray(touches: TouchList): Touch[];
export declare function getTouchCoords(e: TouchEvent, previousTouches: Touch[], dom: HTMLElement): TouchCoords;
export declare function getWheelDelta(e: WheelEvent): number;
export default abstract class Captor<Events extends EventsMapping, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends TypedEventEmitter<Events> {
container: HTMLElement;
renderer: Sigma<N, E, G>;
constructor(container: HTMLElement, renderer: Sigma<N, E, G>);
abstract kill(): void;
}

View File

@@ -0,0 +1,49 @@
import { Attributes } from "graphology-types";
import { Settings } from "../../settings.js";
import Sigma from "../../sigma.js";
import { CameraState, MouseCoords, WheelCoords } from "../../types.js";
import Captor from "./captor.js";
export declare const MOUSE_SETTINGS_KEYS: readonly ["doubleClickTimeout", "doubleClickZoomingDuration", "doubleClickZoomingRatio", "dragTimeout", "draggedEventsTolerance", "inertiaDuration", "inertiaRatio", "zoomDuration", "zoomingRatio"];
export type MouseSettingKey = (typeof MOUSE_SETTINGS_KEYS)[number];
export type MouseSettings = Pick<Settings, MouseSettingKey>;
export declare const DEFAULT_MOUSE_SETTINGS: MouseSettings;
export type MouseCaptorEvents = {
click(coordinates: MouseCoords): void;
rightClick(coordinates: MouseCoords): void;
doubleClick(coordinates: MouseCoords): void;
mouseup(coordinates: MouseCoords): void;
mousedown(coordinates: MouseCoords): void;
mousemove(coordinates: MouseCoords): void;
mousemovebody(coordinates: MouseCoords): void;
mouseleave(coordinates: MouseCoords): void;
mouseenter(coordinates: MouseCoords): void;
wheel(coordinates: WheelCoords): void;
};
export default class MouseCaptor<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Captor<MouseCaptorEvents, N, E, G> {
enabled: boolean;
draggedEvents: number;
downStartTime: number | null;
lastMouseX: number | null;
lastMouseY: number | null;
isMouseDown: boolean;
isMoving: boolean;
movingTimeout: number | null;
startCameraState: CameraState | null;
clicks: number;
doubleClickTimeout: number | null;
currentWheelDirection: -1 | 0 | 1;
lastWheelTriggerTime?: number;
settings: MouseSettings;
constructor(container: HTMLElement, renderer: Sigma<N, E, G>);
kill(): void;
handleClick(e: MouseEvent): void;
handleRightClick(e: MouseEvent): void;
handleDoubleClick(e: MouseEvent): void;
handleDown(e: MouseEvent): void;
handleUp(e: MouseEvent): void;
handleMove(e: MouseEvent): void;
handleLeave(e: MouseEvent): void;
handleEnter(e: MouseEvent): void;
handleWheel(e: WheelEvent): void;
setSettings(settings: MouseSettings): void;
}

View File

@@ -0,0 +1,36 @@
import { Attributes } from "graphology-types";
import { Settings } from "../../settings.js";
import Sigma from "../../sigma.js";
import { CameraState, Coordinates, Dimensions, TouchCoords } from "../../types.js";
import Captor from "./captor.js";
export declare const TOUCH_SETTINGS_KEYS: readonly ["dragTimeout", "inertiaDuration", "inertiaRatio", "doubleClickTimeout", "doubleClickZoomingRatio", "doubleClickZoomingDuration", "tapMoveTolerance"];
export type TouchSettingKey = (typeof TOUCH_SETTINGS_KEYS)[number];
export type TouchSettings = Pick<Settings, TouchSettingKey>;
export declare const DEFAULT_TOUCH_SETTINGS: TouchSettings;
export type TouchCaptorEventType = "touchdown" | "touchup" | "touchmove" | "touchmovebody" | "tap" | "doubletap";
export type TouchCaptorEvents = Record<TouchCaptorEventType, (coordinates: TouchCoords) => void>;
export default class TouchCaptor<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Captor<TouchCaptorEvents, N, E, G> {
enabled: boolean;
isMoving: boolean;
hasMoved: boolean;
startCameraState?: CameraState;
touchMode: number;
movingTimeout?: number;
startTouchesAngle?: number;
startTouchesDistance?: number;
startTouchesPositions: Coordinates[];
lastTouchesPositions?: Coordinates[];
lastTouches: Touch[];
lastTap: null | {
position: Coordinates;
time: number;
};
settings: TouchSettings;
constructor(container: HTMLElement, renderer: Sigma<N, E, G>);
kill(): void;
getDimensions(): Dimensions;
handleStart(e: TouchEvent): void;
handleLeave(e: TouchEvent): void;
handleMove(e: TouchEvent): void;
setSettings(settings: TouchSettings): void;
}

View File

@@ -0,0 +1,6 @@
import Camera from "./core/camera.js";
import MouseCaptor from "./core/captors/mouse.js";
import TouchCaptor from "./core/captors/touch.js";
import Sigma from "./sigma.js";
export default Sigma;
export { Sigma, Camera, MouseCaptor, TouchCaptor };

View File

@@ -0,0 +1,5 @@
import { Attributes } from "graphology-types";
import { Settings } from "../settings.js";
import { EdgeDisplayData, NodeDisplayData, PartialButFor } from "../types.js";
export type EdgeLabelDrawingFunction<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = (context: CanvasRenderingContext2D, edgeData: PartialButFor<EdgeDisplayData, "label" | "color" | "size">, sourceData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, targetData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, settings: Settings<N, E, G>) => void;
export declare function drawStraightEdgeLabel<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(context: CanvasRenderingContext2D, edgeData: PartialButFor<EdgeDisplayData, "label" | "color" | "size">, sourceData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, targetData: PartialButFor<NodeDisplayData, "x" | "y" | "size">, settings: Settings<N, E, G>): void;

View File

@@ -0,0 +1,26 @@
import { Attributes } from "graphology-types";
import Sigma from "../sigma.js";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../types.js";
import { EdgeLabelDrawingFunction } from "./edge-labels.js";
import { AbstractProgram, Program } from "./program.js";
export declare abstract class AbstractEdgeProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends AbstractProgram<N, E, G> {
abstract drawLabel: EdgeLabelDrawingFunction<N, E, G> | undefined;
abstract process(edgeIndex: number, offset: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
}
export declare abstract class EdgeProgram<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Program<Uniform, N, E, G> implements AbstractEdgeProgram<N, E, G> {
drawLabel: EdgeLabelDrawingFunction<N, E, G> | undefined;
kill(): void;
process(edgeIndex: number, offset: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
abstract processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
}
declare class _EdgeProgramClass<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> implements AbstractEdgeProgram<N, E, G> {
constructor(_gl: WebGLRenderingContext, _pickingBuffer: WebGLFramebuffer | null, _renderer: Sigma<N, E, G>);
drawLabel: EdgeLabelDrawingFunction<N, E, G> | undefined;
kill(): void;
reallocate(_capacity: number): void;
process(_edgeIndex: number, _offset: number, _sourceData: NodeDisplayData, _targetData: NodeDisplayData, _data: EdgeDisplayData): void;
render(_params: RenderParams): void;
}
export type EdgeProgramType<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = typeof _EdgeProgramClass<N, E, G>;
export declare function createEdgeCompoundProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(programClasses: Array<EdgeProgramType<N, E, G>>, drawLabel?: EdgeLabelDrawingFunction<N, E, G>): EdgeProgramType<N, E, G>;
export {};

View File

@@ -0,0 +1,23 @@
export { NodeProgram, AbstractNodeProgram, createNodeCompoundProgram } from "./node.js";
export type { NodeProgramType } from "./node.js";
export { EdgeProgram, AbstractEdgeProgram, createEdgeCompoundProgram } from "./edge.js";
export type { EdgeProgramType } from "./edge.js";
export { Program, AbstractProgram } from "./program.js";
export type { ProgramType } from "./program.js";
export type { EdgeLabelDrawingFunction } from "./edge-labels.js";
export { drawStraightEdgeLabel } from "./edge-labels.js";
export type { NodeLabelDrawingFunction } from "./node-labels.js";
export { drawDiscNodeLabel } from "./node-labels.js";
export type { NodeHoverDrawingFunction } from "./node-hover.js";
export { drawDiscNodeHover } from "./node-hover.js";
export * from "./utils.js";
export { default as NodeCircleProgram } from "./programs/node-circle/index.js";
export { default as NodePointProgram } from "./programs/node-point/index.js";
export { default as EdgeArrowHeadProgram, createEdgeArrowHeadProgram, DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, type CreateEdgeArrowHeadProgramOptions, } from "./programs/edge-arrow-head/index.js";
export { default as EdgeClampedProgram, createEdgeClampedProgram, DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS, type CreateEdgeClampedProgramOptions, } from "./programs/edge-clamped/index.js";
export { default as EdgeDoubleClampedProgram, createEdgeDoubleClampedProgram, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS, type CreateEdgeDoubleClampedProgramOptions, } from "./programs/edge-double-clamped/index.js";
export { default as EdgeArrowProgram, createEdgeArrowProgram } from "./programs/edge-arrow/index.js";
export { default as EdgeDoubleArrowProgram, createEdgeDoubleArrowProgram } from "./programs/edge-double-arrow/index.js";
export { default as EdgeLineProgram } from "./programs/edge-line/index.js";
export { default as EdgeRectangleProgram } from "./programs/edge-rectangle/index.js";
export { default as EdgeTriangleProgram } from "./programs/edge-triangle/index.js";

View File

@@ -0,0 +1,5 @@
import { Attributes } from "graphology-types";
import { Settings } from "../settings.js";
import { NodeDisplayData, PartialButFor } from "../types.js";
export type NodeHoverDrawingFunction<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = (context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>) => void;
export declare function drawDiscNodeHover<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>): void;

View File

@@ -0,0 +1,5 @@
import { Attributes } from "graphology-types";
import { Settings } from "../settings.js";
import { NodeDisplayData, PartialButFor } from "../types.js";
export type NodeLabelDrawingFunction<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = (context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>) => void;
export declare function drawDiscNodeLabel<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(context: CanvasRenderingContext2D, data: PartialButFor<NodeDisplayData, "x" | "y" | "size" | "label" | "color">, settings: Settings<N, E, G>): void;

View File

@@ -0,0 +1,30 @@
import { Attributes } from "graphology-types";
import Sigma from "../sigma.js";
import { NodeDisplayData, NonEmptyArray, RenderParams } from "../types.js";
import { NodeHoverDrawingFunction } from "./node-hover.js";
import { NodeLabelDrawingFunction } from "./node-labels.js";
import { AbstractProgram, Program } from "./program.js";
export declare abstract class AbstractNodeProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends AbstractProgram<N, E, G> {
abstract drawLabel: NodeLabelDrawingFunction<N, E, G> | undefined;
abstract drawHover: NodeHoverDrawingFunction<N, E, G> | undefined;
abstract process(nodeIndex: number, offset: number, data: NodeDisplayData): void;
}
export declare abstract class NodeProgram<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Program<Uniform, N, E, G> implements AbstractNodeProgram<N, E, G> {
drawLabel: NodeLabelDrawingFunction<N, E, G> | undefined;
drawHover: NodeHoverDrawingFunction<N, E, G> | undefined;
kill(): void;
process(nodeIndex: number, offset: number, data: NodeDisplayData): void;
abstract processVisibleItem(nodeIndex: number, i: number, data: NodeDisplayData): void;
}
declare class _NodeProgramClass<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> implements AbstractNodeProgram<N, E, G> {
constructor(_gl: WebGLRenderingContext, _pickingBuffer: WebGLFramebuffer | null, _renderer: Sigma<N, E, G>);
drawLabel: NodeLabelDrawingFunction<N, E, G> | undefined;
drawHover: NodeHoverDrawingFunction<N, E, G> | undefined;
kill(): void;
reallocate(_capacity: number): void;
process(_nodeIndex: number, _offset: number, _data: NodeDisplayData): void;
render(_params: RenderParams): void;
}
export type NodeProgramType<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = typeof _NodeProgramClass<N, E, G>;
export declare function createNodeCompoundProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(programClasses: NonEmptyArray<NodeProgramType<N, E, G>>, drawLabel?: NodeLabelDrawingFunction<N, E, G>, drawHover?: NodeLabelDrawingFunction<N, E, G>): NodeProgramType<N, E, G>;
export {};

View File

@@ -0,0 +1,50 @@
import { Attributes } from "graphology-types";
import type Sigma from "../sigma.js";
import type { RenderParams } from "../types.js";
import { InstancedProgramDefinition, ProgramAttributeSpecification, ProgramDefinition, ProgramInfo } from "./utils.js";
export declare abstract class AbstractProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> {
constructor(_gl: WebGLRenderingContext, _pickGl: WebGLRenderingContext, _renderer: Sigma<N, E, G>);
abstract reallocate(capacity: number): void;
abstract render(params: RenderParams): void;
abstract kill(): void;
}
export declare abstract class Program<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> implements AbstractProgram<N, E, G>, InstancedProgramDefinition {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
UNIFORMS: ReadonlyArray<Uniform>;
ATTRIBUTES: Array<ProgramAttributeSpecification>;
METHOD: number;
CONSTANT_ATTRIBUTES: Array<ProgramAttributeSpecification>;
CONSTANT_DATA: number[][];
ATTRIBUTES_ITEMS_COUNT: number;
STRIDE: number;
renderer: Sigma<N, E, G>;
array: Float32Array;
constantArray: Float32Array;
capacity: number;
verticesCount: number;
normalProgram: ProgramInfo;
pickProgram: ProgramInfo | null;
isInstanced: boolean;
abstract getDefinition(): ProgramDefinition<Uniform> | InstancedProgramDefinition<Uniform>;
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, pickingBuffer: WebGLFramebuffer | null, renderer: Sigma<N, E, G>);
kill(): void;
protected getProgramInfo(name: "normal" | "pick", gl: WebGLRenderingContext | WebGL2RenderingContext, vertexShaderSource: string, fragmentShaderSource: string, frameBuffer: WebGLFramebuffer | null): ProgramInfo;
protected bindProgram(program: ProgramInfo): void;
protected unbindProgram(program: ProgramInfo): void;
protected bindAttribute(attr: ProgramAttributeSpecification, program: ProgramInfo, offset: number, setDivisor?: boolean): number;
protected unbindAttribute(attr: ProgramAttributeSpecification, program: ProgramInfo, unsetDivisor?: boolean): void;
reallocate(capacity: number): void;
hasNothingToRender(): boolean;
abstract setUniforms(params: RenderParams, programInfo: ProgramInfo): void;
protected renderProgram(params: RenderParams, programInfo: ProgramInfo): void;
render(params: RenderParams): void;
drawWebGL(method: number, { gl, frameBuffer }: ProgramInfo): void;
}
declare class _ProgramClass<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends Program<Uniform, N, E, G> {
getDefinition(): ProgramDefinition<Uniform> | InstancedProgramDefinition<Uniform>;
setUniforms(_params: RenderParams, _programInfo: ProgramInfo): undefined;
}
export type ProgramType<Uniform extends string = string, N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> = typeof _ProgramClass<Uniform, N, E, G>;
export {};

View File

@@ -0,0 +1,11 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
export type CreateEdgeArrowHeadProgramOptions = {
extremity: "source" | "target";
lengthToThicknessRatio: number;
widenessToThicknessRatio: number;
};
export declare const DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS: CreateEdgeArrowHeadProgramOptions;
export declare function createEdgeArrowHeadProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeArrowHeadProgramOptions>): EdgeProgramType<N, E, G>;
declare const EdgeArrowHeadProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeArrowHeadProgram;

View File

@@ -0,0 +1,6 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export declare function createEdgeArrowProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<Omit<CreateEdgeArrowHeadProgramOptions, "extremity">>): EdgeProgramType<N, E, G>;
declare const EdgeArrowProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeArrowProgram;

View File

@@ -0,0 +1,8 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export type CreateEdgeClampedProgramOptions = Pick<CreateEdgeArrowHeadProgramOptions, "lengthToThicknessRatio">;
export declare const DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS: CreateEdgeClampedProgramOptions;
export declare function createEdgeClampedProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeClampedProgramOptions>): EdgeProgramType<N, E, G>;
declare const EdgeClampedProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeClampedProgram;

View File

@@ -0,0 +1,6 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export declare function createEdgeDoubleArrowProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<Omit<CreateEdgeArrowHeadProgramOptions, "extremity">>): EdgeProgramType<N, E, G>;
declare const EdgeDoubleArrowProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeDoubleArrowProgram;

View File

@@ -0,0 +1,8 @@
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export type CreateEdgeDoubleClampedProgramOptions = Pick<CreateEdgeArrowHeadProgramOptions, "lengthToThicknessRatio">;
export declare const DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS: CreateEdgeDoubleClampedProgramOptions;
export declare function createEdgeDoubleClampedProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeDoubleClampedProgramOptions>): EdgeProgramType<N, E, G>;
declare const EdgeDoubleClampedProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeDoubleClampedProgram;

View File

@@ -0,0 +1,28 @@
import { Attributes } from "graphology-types";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../../../types.js";
import { EdgeProgram } from "../../edge.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_matrix"];
export default class EdgeLineProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends EdgeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 1;
UNIFORMS: readonly ["u_matrix"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
};
processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,34 @@
import { Attributes } from "graphology-types";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../../../types.js";
import { EdgeProgram } from "../../edge.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness"];
export default class EdgeRectangleProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends EdgeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 4;
UNIFORMS: readonly ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
CONSTANT_ATTRIBUTES: {
name: string;
size: number;
type: 5126;
}[];
CONSTANT_DATA: number[][];
};
processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,34 @@
import { Attributes } from "graphology-types";
import { EdgeDisplayData, NodeDisplayData, RenderParams } from "../../../types.js";
import { EdgeProgram } from "../../edge.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_matrix", "u_sizeRatio", "u_correctionRatio", "u_minEdgeThickness"];
export default class EdgeTriangleProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends EdgeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 4;
UNIFORMS: readonly ["u_matrix", "u_sizeRatio", "u_correctionRatio", "u_minEdgeThickness"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
CONSTANT_ATTRIBUTES: {
name: string;
size: number;
type: 5126;
}[];
CONSTANT_DATA: number[][];
};
processVisibleItem(edgeIndex: number, startIndex: number, sourceData: NodeDisplayData, targetData: NodeDisplayData, data: EdgeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,37 @@
import { Attributes } from "graphology-types";
import { NodeDisplayData, RenderParams } from "../../../types.js";
import { NodeProgram } from "../../node.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_sizeRatio", "u_correctionRatio", "u_matrix"];
export default class NodeCircleProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends NodeProgram<(typeof UNIFORMS)[number], N, E, G> {
static readonly ANGLE_1 = 0;
static readonly ANGLE_2: number;
static readonly ANGLE_3: number;
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 4;
UNIFORMS: readonly ["u_sizeRatio", "u_correctionRatio", "u_matrix"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
CONSTANT_ATTRIBUTES: {
name: string;
size: number;
type: 5126;
}[];
CONSTANT_DATA: number[][];
};
processVisibleItem(nodeIndex: number, startIndex: number, data: NodeDisplayData): void;
setUniforms(params: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,28 @@
import { Attributes } from "graphology-types";
import { NodeDisplayData, RenderParams } from "../../../types.js";
import { NodeProgram } from "../../node.js";
import { ProgramInfo } from "../../utils.js";
declare const UNIFORMS: readonly ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
export default class NodePointProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends NodeProgram<(typeof UNIFORMS)[number], N, E, G> {
getDefinition(): {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
METHOD: 0;
UNIFORMS: readonly ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
ATTRIBUTES: ({
name: string;
size: number;
type: 5126;
normalized?: undefined;
} | {
name: string;
size: number;
type: 5121;
normalized: boolean;
})[];
};
processVisibleItem(nodeIndex: number, startIndex: number, data: NodeDisplayData): void;
setUniforms({ sizeRatio, pixelRatio, matrix }: RenderParams, { gl, uniformLocations }: ProgramInfo): void;
}
export {};

View File

@@ -0,0 +1,38 @@
export declare function getAttributeItemsCount(attr: ProgramAttributeSpecification): number;
export declare function getAttributesItemsCount(attrs: ProgramAttributeSpecification[]): number;
export interface ProgramInfo<Uniform extends string = string> {
name: string;
isPicking: boolean;
program: WebGLProgram;
gl: WebGLRenderingContext | WebGL2RenderingContext;
frameBuffer: WebGLFramebuffer | null;
buffer: WebGLBuffer;
constantBuffer: WebGLBuffer;
uniformLocations: Record<Uniform, WebGLUniformLocation>;
attributeLocations: Record<string, number>;
vertexShader: WebGLShader;
fragmentShader: WebGLShader;
}
export interface ProgramAttributeSpecification {
name: string;
size: number;
type: number;
normalized?: boolean;
}
export interface ProgramDefinition<Uniform extends string = string> {
VERTICES: number;
VERTEX_SHADER_SOURCE: string;
FRAGMENT_SHADER_SOURCE: string;
UNIFORMS: ReadonlyArray<Uniform>;
ATTRIBUTES: Array<ProgramAttributeSpecification>;
METHOD: number;
}
export interface InstancedProgramDefinition<Uniform extends string = string> extends ProgramDefinition<Uniform> {
CONSTANT_ATTRIBUTES: Array<ProgramAttributeSpecification>;
CONSTANT_DATA: number[][];
}
export declare function loadVertexShader(gl: WebGLRenderingContext, source: string): WebGLShader;
export declare function loadFragmentShader(gl: WebGLRenderingContext, source: string): WebGLShader;
export declare function loadProgram(gl: WebGLRenderingContext, shaders: Array<WebGLShader>): WebGLProgram;
export declare function killProgram({ gl, buffer, program, vertexShader, fragmentShader }: ProgramInfo): void;
export declare function numberToGLSLFloat(n: number): string;

View File

@@ -0,0 +1,87 @@
import { Attributes } from "graphology-types";
import { EdgeLabelDrawingFunction, EdgeProgramType, NodeHoverDrawingFunction, NodeLabelDrawingFunction, NodeProgramType } from "./rendering/index.js";
import { AtLeastOne, EdgeDisplayData, NodeDisplayData } from "./types.js";
export interface Settings<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> {
hideEdgesOnMove: boolean;
hideLabelsOnMove: boolean;
renderLabels: boolean;
renderEdgeLabels: boolean;
enableEdgeEvents: boolean;
defaultNodeColor: string;
defaultNodeType: string;
defaultEdgeColor: string;
defaultEdgeType: string;
labelFont: string;
labelSize: number;
labelWeight: string;
labelColor: {
attribute: string;
color?: string;
} | {
color: string;
attribute?: undefined;
};
edgeLabelFont: string;
edgeLabelSize: number;
edgeLabelWeight: string;
edgeLabelColor: {
attribute: string;
color?: string;
} | {
color: string;
attribute?: undefined;
};
stagePadding: number;
defaultDrawEdgeLabel: EdgeLabelDrawingFunction<N, E, G>;
defaultDrawNodeLabel: NodeLabelDrawingFunction<N, E, G>;
defaultDrawNodeHover: NodeHoverDrawingFunction<N, E, G>;
minEdgeThickness: number;
antiAliasingFeather: number;
dragTimeout: number;
draggedEventsTolerance: number;
inertiaDuration: number;
inertiaRatio: number;
zoomDuration: number;
zoomingRatio: number;
doubleClickTimeout: number;
doubleClickZoomingRatio: number;
doubleClickZoomingDuration: number;
tapMoveTolerance: number;
zoomToSizeRatioFunction: (ratio: number) => number;
itemSizesReference: "screen" | "positions";
autoRescale: boolean;
autoCenter: boolean;
labelDensity: number;
labelGridCellSize: number;
labelRenderedSizeThreshold: number;
nodeReducer: null | ((node: string, data: N) => Partial<NodeDisplayData>);
edgeReducer: null | ((edge: string, data: E) => Partial<EdgeDisplayData>);
zIndex: boolean;
minCameraRatio: null | number;
maxCameraRatio: null | number;
enableCameraZooming: boolean;
enableCameraPanning: boolean;
enableCameraRotation: boolean;
cameraPanBoundaries: null | true | AtLeastOne<{
tolerance: number;
boundaries: {
x: [number, number];
y: [number, number];
};
}>;
allowInvalidContainer: boolean;
nodeProgramClasses: {
[type: string]: NodeProgramType<N, E, G>;
};
nodeHoverProgramClasses: {
[type: string]: NodeProgramType<N, E, G>;
};
edgeProgramClasses: {
[type: string]: EdgeProgramType<N, E, G>;
};
}
export declare const DEFAULT_SETTINGS: Settings<Attributes, Attributes, Attributes>;
export declare const DEFAULT_NODE_PROGRAM_CLASSES: Record<string, NodeProgramType>;
export declare const DEFAULT_EDGE_PROGRAM_CLASSES: Record<string, EdgeProgramType>;
export declare function validateSettings<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(settings: Settings<N, E, G>): void;
export declare function resolveSettings<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(settings: Partial<Settings<N, E, G>>): Settings<N, E, G>;

187
web/node_modules/sigma/dist/declarations/src/sigma.d.ts generated vendored Normal file
View File

@@ -0,0 +1,187 @@
import Graph, { Attributes } from "graphology-types";
import Camera from "./core/camera.js";
import MouseCaptor from "./core/captors/mouse.js";
import TouchCaptor from "./core/captors/touch.js";
import { Settings } from "./settings.js";
import { CameraState, CoordinateConversionOverride, Coordinates, Dimensions, EdgeDisplayData, Extent, NodeDisplayData, PlainObject, RenderParams, SigmaEvents, TypedEventEmitter } from "./types.js";
export default class Sigma<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes> extends TypedEventEmitter<SigmaEvents> {
private settings;
private graph;
private mouseCaptor;
private touchCaptor;
private container;
private elements;
private canvasContexts;
private webGLContexts;
private pickingLayers;
private textures;
private frameBuffers;
private activeListeners;
private labelGrid;
private nodeDataCache;
private edgeDataCache;
private nodeProgramIndex;
private edgeProgramIndex;
private nodesWithForcedLabels;
private edgesWithForcedLabels;
private nodeExtent;
private nodeZExtent;
private edgeZExtent;
private matrix;
private invMatrix;
private correctionRatio;
private customBBox;
private normalizationFunction;
private graphToViewportRatio;
private itemIDsIndex;
private nodeIndices;
private edgeIndices;
private width;
private height;
private pixelRatio;
private pickingDownSizingRatio;
private displayedNodeLabels;
private displayedEdgeLabels;
private highlightedNodes;
private hoveredNode;
private hoveredEdge;
private renderFrame;
private renderHighlightedNodesFrame;
private needToProcess;
private checkEdgesEventsFrame;
private nodePrograms;
private nodeHoverPrograms;
private edgePrograms;
private camera;
constructor(graph: Graph<N, E, G>, container: HTMLElement, settings?: Partial<Settings<N, E, G>>);
private registerNodeProgram;
private registerEdgeProgram;
private unregisterNodeProgram;
private unregisterEdgeProgram;
private resetWebGLTexture;
private bindCameraHandlers;
private unbindCameraHandlers;
private getNodeAtPosition;
private bindEventHandlers;
private bindGraphHandlers;
private unbindGraphHandlers;
private getEdgeAtPoint;
private process;
private handleSettingsUpdate;
private cleanCameraState;
private renderLabels;
private renderEdgeLabels;
private renderHighlightedNodes;
private scheduleHighlightedNodesRender;
private render;
private addNode;
private updateNode;
private removeNode;
private addEdge;
private updateEdge;
private removeEdge;
private clearNodeIndices;
private clearEdgeIndices;
private clearIndices;
private clearNodeState;
private clearEdgeState;
private clearState;
private addNodeToProgram;
private addEdgeToProgram;
getRenderParams(): RenderParams;
getStagePadding(): number;
createLayer<T extends HTMLElement>(id: string, tag: string, options?: {
style?: Partial<CSSStyleDeclaration>;
} & ({
beforeLayer?: string;
} | {
afterLayer?: string;
})): T;
createCanvas(id: string, options?: {
style?: Partial<CSSStyleDeclaration>;
} & ({
beforeLayer?: string;
} | {
afterLayer?: string;
})): HTMLCanvasElement;
createCanvasContext(id: string, options?: {
style?: Partial<CSSStyleDeclaration>;
}): this;
createWebGLContext(id: string, options?: {
preserveDrawingBuffer?: boolean;
antialias?: boolean;
hidden?: boolean;
picking?: boolean;
} & ({
canvas?: HTMLCanvasElement;
style?: undefined;
} | {
style?: CSSStyleDeclaration;
canvas?: undefined;
})): WebGLRenderingContext;
killLayer(id: string): this;
getCamera(): Camera;
setCamera(camera: Camera): void;
getContainer(): HTMLElement;
getGraph(): Graph<N, E, G>;
setGraph(graph: Graph<N, E, G>): void;
getMouseCaptor(): MouseCaptor<N, E, G>;
getTouchCaptor(): TouchCaptor<N, E, G>;
getDimensions(): Dimensions;
getGraphDimensions(): Dimensions;
getNodeDisplayData(key: unknown): NodeDisplayData | undefined;
getEdgeDisplayData(key: unknown): EdgeDisplayData | undefined;
getNodeDisplayedLabels(): Set<string>;
getEdgeDisplayedLabels(): Set<string>;
getSettings(): Settings<N, E, G>;
getSetting<K extends keyof Settings<N, E, G>>(key: K): Settings<N, E, G>[K];
setSetting<K extends keyof Settings<N, E, G>>(key: K, value: Settings<N, E, G>[K]): this;
updateSetting<K extends keyof Settings<N, E, G>>(key: K, updater: (value: Settings<N, E, G>[K]) => Settings<N, E, G>[K]): this;
setSettings(settings: Partial<Settings<N, E, G>>): this;
resize(force?: boolean): this;
clear(): this;
refresh(opts?: {
partialGraph?: {
nodes?: string[];
edges?: string[];
};
schedule?: boolean;
skipIndexation?: boolean;
}): this;
scheduleRender(): this;
scheduleRefresh(opts?: {
partialGraph?: {
nodes?: string[];
edges?: string[];
};
layoutUnchange?: boolean;
}): this;
getViewportZoomedState(viewportTarget: Coordinates, newRatio: number): CameraState;
viewRectangle(): {
x1: number;
y1: number;
x2: number;
y2: number;
height: number;
};
framedGraphToViewport(coordinates: Coordinates, override?: CoordinateConversionOverride): Coordinates;
viewportToFramedGraph(coordinates: Coordinates, override?: CoordinateConversionOverride): Coordinates;
viewportToGraph(viewportPoint: Coordinates, override?: CoordinateConversionOverride): Coordinates;
graphToViewport(graphPoint: Coordinates, override?: CoordinateConversionOverride): Coordinates;
getGraphToViewportRatio(): number;
getBBox(): {
x: Extent;
y: Extent;
};
getCustomBBox(): {
x: Extent;
y: Extent;
} | null;
setCustomBBox(customBBox: {
x: Extent;
y: Extent;
} | null): this;
kill(): void;
scaleSize(size?: number, cameraRatio?: number): number;
getCanvases(): PlainObject<HTMLCanvasElement>;
}

136
web/node_modules/sigma/dist/declarations/src/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,136 @@
import { EventEmitter } from "events";
export type PlainObject<T = any> = {
[k: string]: T;
};
export type PartialButFor<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>> & {
[others: string]: any;
};
export type AtLeastOne<T, U = {
[K in keyof T]: Pick<T, K>;
}> = Partial<T> & U[keyof U];
export type NonEmptyArray<T> = [T, ...T[]];
export interface Coordinates {
x: number;
y: number;
}
export interface CameraState extends Coordinates {
angle: number;
ratio: number;
}
export type MouseInteraction = "click" | "doubleClick" | "rightClick" | "wheel" | "down" | "up" | "leave" | "enter";
export interface MouseCoords extends Coordinates {
sigmaDefaultPrevented: boolean;
preventSigmaDefault(): void;
original: MouseEvent | TouchEvent;
}
export interface WheelCoords extends MouseCoords {
delta: number;
}
export interface TouchCoords {
touches: Coordinates[];
previousTouches: Coordinates[];
sigmaDefaultPrevented: boolean;
preventSigmaDefault(): void;
original: TouchEvent;
}
export interface Dimensions {
width: number;
height: number;
}
export type Extent = [number, number];
export interface DisplayData {
label: string | null;
size: number;
color: string;
hidden: boolean;
forceLabel: boolean;
zIndex: number;
type: string;
}
export interface NodeDisplayData extends Coordinates, DisplayData {
highlighted: boolean;
}
export type EdgeDisplayData = DisplayData;
export type CoordinateConversionOverride = {
cameraState?: CameraState;
matrix?: Float32Array;
viewportDimensions?: Dimensions;
graphDimensions?: Dimensions;
padding?: number;
};
export interface RenderParams {
width: number;
height: number;
sizeRatio: number;
zoomRatio: number;
pixelRatio: number;
cameraAngle: number;
correctionRatio: number;
matrix: Float32Array;
invMatrix: Float32Array;
downSizingRatio: number;
minEdgeThickness: number;
antiAliasingFeather: number;
}
export type Listener = (...args: any[]) => void;
export type EventsMapping = Record<string, Listener>;
interface ITypedEventEmitter<Events extends EventsMapping> {
rawEmitter: EventEmitter;
eventNames<Event extends keyof Events>(): Array<Event>;
setMaxListeners(n: number): this;
getMaxListeners(): number;
emit<Event extends keyof Events>(type: Event, ...args: Parameters<Events[Event]>): boolean;
addListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
on<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
once<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
prependListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
prependOnceListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
removeListener<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
off<Event extends keyof Events>(type: Event, listener: Events[Event]): this;
removeAllListeners<Event extends keyof Events>(type?: Event): this;
listeners<Event extends keyof Events>(type: Event): Events[Event][];
listenerCount<Event extends keyof Events>(type: Event): number;
rawListeners<Event extends keyof Events>(type: Event): Events[Event][];
}
declare const TypedEventEmitter_base: {
new <T extends EventsMapping>(): ITypedEventEmitter<T>;
};
export declare class TypedEventEmitter<Events extends EventsMapping> extends TypedEventEmitter_base<Events> {
constructor();
}
export interface SigmaEventPayload {
event: MouseCoords;
preventSigmaDefault(): void;
}
export type SigmaStageEventPayload = SigmaEventPayload;
export interface SigmaNodeEventPayload extends SigmaEventPayload {
node: string;
}
export interface SigmaEdgeEventPayload extends SigmaEventPayload {
edge: string;
}
export type SigmaStageEvents = {
[E in MouseInteraction as `${E}Stage`]: (payload: SigmaStageEventPayload) => void;
};
export type SigmaNodeEvents = {
[E in MouseInteraction as `${E}Node`]: (payload: SigmaNodeEventPayload) => void;
};
export type SigmaEdgeEvents = {
[E in MouseInteraction as `${E}Edge`]: (payload: SigmaEdgeEventPayload) => void;
};
export type SigmaAdditionalEvents = {
beforeClear(): void;
afterClear(): void;
beforeProcess(): void;
afterProcess(): void;
beforeRender(): void;
afterRender(): void;
resize(): void;
kill(): void;
moveBody(payload: SigmaStageEventPayload): void;
};
export type SigmaEvents = SigmaStageEvents & SigmaNodeEvents & SigmaEdgeEvents & SigmaAdditionalEvents;
export type SigmaEventType = keyof SigmaEvents;
export type { CameraEvents } from "./core/camera.js";
export type { MouseCaptorEvents } from "./core/captors/mouse.js";
export type { TouchCaptorEvents } from "./core/captors/touch.js";

View File

@@ -0,0 +1,13 @@
import Graph from "graphology-types";
import { PlainObject } from "../types.js";
import { easings } from "./easings.js";
export type Easing = keyof typeof easings | ((k: number) => number);
export interface AnimateOptions {
easing: Easing;
duration: number;
}
export declare const ANIMATE_DEFAULTS: {
easing: string;
duration: number;
};
export declare function animateNodes(graph: Graph, targets: PlainObject<PlainObject<number>>, opts: Partial<AnimateOptions>, callback?: () => void): () => void;

View File

@@ -0,0 +1,16 @@
export declare const HTML_COLORS: Record<string, string>;
export declare function extractPixel(gl: WebGLRenderingContext, x: number, y: number, array: Uint8Array): Uint8Array;
type RGBAColor = {
r: number;
g: number;
b: number;
a: number;
};
export declare function parseColor(val: string): RGBAColor;
export declare function rgbaToFloat(r: number, g: number, b: number, a: number, masking?: boolean): number;
export declare function floatColor(val: string): number;
export declare function colorToArray(val: string, masking?: boolean): [number, number, number, number];
export declare function indexToColor(index: number): number;
export declare function colorToIndex(r: number, g: number, b: number, _a: number): number;
export declare function getPixelColor(gl: WebGLRenderingContext, frameBuffer: WebGLBuffer | null, x: number, y: number, pixelRatio: number, downSizingRatio: number): [number, number, number, number];
export {};

View File

@@ -0,0 +1,16 @@
import { CameraState, Dimensions } from "../types.js";
export declare function getCorrectionRatio(viewportDimensions: {
width: number;
height: number;
}, graphDimensions: {
width: number;
height: number;
}): number;
export declare function matrixFromCamera(state: CameraState, viewportDimensions: {
width: number;
height: number;
}, graphDimensions: {
width: number;
height: number;
}, padding: number, inverse?: boolean): Float32Array;
export declare function getMatrixImpact(matrix: Float32Array, cameraState: CameraState, viewportDimensions: Dimensions): number;

View File

@@ -0,0 +1,4 @@
export declare function extend<T>(array: T[], values: Set<T>): void;
export declare function isPlainObject(value: unknown): boolean;
export declare function assign<T>(target: Partial<T> | undefined, ...objects: Array<Partial<T | undefined>>): T;
export declare function assignDeep<T>(target: Partial<T> | undefined, ...objects: Array<Partial<T | undefined>>): T;

View File

@@ -0,0 +1,10 @@
export declare const linear: (k: number) => number;
export declare const quadraticIn: (k: number) => number;
export declare const quadraticOut: (k: number) => number;
export declare const quadraticInOut: (k: number) => number;
export declare const cubicIn: (k: number) => number;
export declare const cubicOut: (k: number) => number;
export declare const cubicInOut: (k: number) => number;
export declare const easings: {
[key: string]: (k: number) => number;
};

View File

@@ -0,0 +1,7 @@
import Graph from "graphology-types";
import { Extent } from "../types.js";
export declare function graphExtent(graph: Graph): {
x: Extent;
y: Extent;
};
export declare function validateGraph(graph: Graph): void;

View File

@@ -0,0 +1,9 @@
export * from "./animate.js";
export * from "./colors.js";
export * from "./coordinates.js";
export * from "./data.js";
export * from "./easings.js";
export * from "./graph.js";
export * from "./matrices.js";
export * from "./misc.js";
export * from "./normalization.js";

View File

@@ -0,0 +1,7 @@
import { Coordinates } from "../types.js";
export declare function identity(): Float32Array;
export declare function scale(m: Float32Array, x: number, y?: number): Float32Array;
export declare function rotate(m: Float32Array, r: number): Float32Array;
export declare function translate(m: Float32Array, x: number, y: number): Float32Array;
export declare function multiply<T extends number[] | Float32Array>(a: T, b: Float32Array | number[]): T;
export declare function multiplyVec2(a: Float32Array | number[], b: Coordinates, z?: number): Coordinates;

View File

@@ -0,0 +1,4 @@
import { Extent, PlainObject } from "../types.js";
export declare function createElement<T extends HTMLElement>(tag: string, style?: Partial<CSSStyleDeclaration>, attributes?: PlainObject<string>): T;
export declare function getPixelRatio(): number;
export declare function zIndexOrdering<T>(_extent: Extent, getter: (e: T) => number, elements: Array<T>): Array<T>;

View File

@@ -0,0 +1,11 @@
import { Coordinates, Extent } from "../types.js";
export interface NormalizationFunction {
(data: Coordinates): Coordinates;
ratio: number;
inverse(data: Coordinates): Coordinates;
applyTo(data: Coordinates): void;
}
export declare function createNormalizationFunction(extent: {
x: Extent;
y: Extent;
}): NormalizationFunction;

1201
web/node_modules/sigma/dist/index-5852423e.cjs.prod.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1201
web/node_modules/sigma/dist/index-5d7c4e29.cjs.dev.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1169
web/node_modules/sigma/dist/index-fad77a13.esm.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
'use strict';
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
function _getPrototypeOf(t) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, _getPrototypeOf(t);
}
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function () {
return !!t;
})();
}
function _assertThisInitialized(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function _possibleConstructorReturn(t, e) {
if (e && ("object" == typeof e || "function" == typeof e)) return e;
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
return _assertThisInitialized(t);
}
function _callSuper(t, o, e) {
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
}
function _setPrototypeOf(t, e) {
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, _setPrototypeOf(t, e);
}
function _inherits(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}), Object.defineProperty(t, "prototype", {
writable: !1
}), e && _setPrototypeOf(t, e);
}
exports._callSuper = _callSuper;
exports._classCallCheck = _classCallCheck;
exports._createClass = _createClass;
exports._getPrototypeOf = _getPrototypeOf;
exports._inherits = _inherits;
exports._toPropertyKey = _toPropertyKey;

View File

@@ -0,0 +1,89 @@
'use strict';
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
function _getPrototypeOf(t) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, _getPrototypeOf(t);
}
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function () {
return !!t;
})();
}
function _assertThisInitialized(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function _possibleConstructorReturn(t, e) {
if (e && ("object" == typeof e || "function" == typeof e)) return e;
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
return _assertThisInitialized(t);
}
function _callSuper(t, o, e) {
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
}
function _setPrototypeOf(t, e) {
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, _setPrototypeOf(t, e);
}
function _inherits(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}), Object.defineProperty(t, "prototype", {
writable: !1
}), e && _setPrototypeOf(t, e);
}
exports._callSuper = _callSuper;
exports._classCallCheck = _classCallCheck;
exports._createClass = _createClass;
exports._getPrototypeOf = _getPrototypeOf;
exports._inherits = _inherits;
exports._toPropertyKey = _toPropertyKey;

82
web/node_modules/sigma/dist/inherits-d1a1e29b.esm.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
function _getPrototypeOf(t) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, _getPrototypeOf(t);
}
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function () {
return !!t;
})();
}
function _assertThisInitialized(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function _possibleConstructorReturn(t, e) {
if (e && ("object" == typeof e || "function" == typeof e)) return e;
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
return _assertThisInitialized(t);
}
function _callSuper(t, o, e) {
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
}
function _setPrototypeOf(t, e) {
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, _setPrototypeOf(t, e);
}
function _inherits(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}), Object.defineProperty(t, "prototype", {
writable: !1
}), e && _setPrototypeOf(t, e);
}
export { _inherits as _, _createClass as a, _classCallCheck as b, _callSuper as c, _toPropertyKey as d, _getPrototypeOf as e };

View File

@@ -0,0 +1,390 @@
'use strict';
var isGraph = require('graphology-utils/is-graph');
var colors = require('./colors-fe6de9d2.cjs.dev.js');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var isGraph__default = /*#__PURE__*/_interopDefault(isGraph);
var linear = function linear(k) {
return k;
};
var quadraticIn = function quadraticIn(k) {
return k * k;
};
var quadraticOut = function quadraticOut(k) {
return k * (2 - k);
};
var quadraticInOut = function quadraticInOut(k) {
if ((k *= 2) < 1) return 0.5 * k * k;
return -0.5 * (--k * (k - 2) - 1);
};
var cubicIn = function cubicIn(k) {
return k * k * k;
};
var cubicOut = function cubicOut(k) {
return --k * k * k + 1;
};
var cubicInOut = function cubicInOut(k) {
if ((k *= 2) < 1) return 0.5 * k * k * k;
return 0.5 * ((k -= 2) * k * k + 2);
};
var easings = {
linear: linear,
quadraticIn: quadraticIn,
quadraticOut: quadraticOut,
quadraticInOut: quadraticInOut,
cubicIn: cubicIn,
cubicOut: cubicOut,
cubicInOut: cubicInOut
};
/**
* Defaults.
*/
var ANIMATE_DEFAULTS = {
easing: "quadraticInOut",
duration: 150
};
/**
* Function used to animate the nodes.
*/
function animateNodes(graph, targets, opts, callback) {
var options = Object.assign({}, ANIMATE_DEFAULTS, opts);
var easing = typeof options.easing === "function" ? options.easing : easings[options.easing];
var start = Date.now();
var startPositions = {};
for (var node in targets) {
var attrs = targets[node];
startPositions[node] = {};
for (var _k in attrs) startPositions[node][_k] = graph.getNodeAttribute(node, _k);
}
var frame = null;
var _step = function step() {
frame = null;
var p = (Date.now() - start) / options.duration;
if (p >= 1) {
// Animation is done
for (var _node in targets) {
var _attrs = targets[_node];
// We use given values to avoid precision issues and for convenience
for (var _k2 in _attrs) graph.setNodeAttribute(_node, _k2, _attrs[_k2]);
}
if (typeof callback === "function") callback();
return;
}
p = easing(p);
for (var _node2 in targets) {
var _attrs2 = targets[_node2];
var s = startPositions[_node2];
for (var _k3 in _attrs2) graph.setNodeAttribute(_node2, _k3, _attrs2[_k3] * p + s[_k3] * (1 - p));
}
frame = requestAnimationFrame(_step);
};
_step();
return function () {
if (frame) cancelAnimationFrame(frame);
};
}
function identity() {
return Float32Array.of(1, 0, 0, 0, 1, 0, 0, 0, 1);
}
// TODO: optimize
function scale(m, x, y) {
m[0] = x;
m[4] = typeof y === "number" ? y : x;
return m;
}
function rotate(m, r) {
var s = Math.sin(r),
c = Math.cos(r);
m[0] = c;
m[1] = s;
m[3] = -s;
m[4] = c;
return m;
}
function translate(m, x, y) {
m[6] = x;
m[7] = y;
return m;
}
function multiply(a, b) {
var a00 = a[0],
a01 = a[1],
a02 = a[2];
var a10 = a[3],
a11 = a[4],
a12 = a[5];
var a20 = a[6],
a21 = a[7],
a22 = a[8];
var b00 = b[0],
b01 = b[1],
b02 = b[2];
var b10 = b[3],
b11 = b[4],
b12 = b[5];
var b20 = b[6],
b21 = b[7],
b22 = b[8];
a[0] = b00 * a00 + b01 * a10 + b02 * a20;
a[1] = b00 * a01 + b01 * a11 + b02 * a21;
a[2] = b00 * a02 + b01 * a12 + b02 * a22;
a[3] = b10 * a00 + b11 * a10 + b12 * a20;
a[4] = b10 * a01 + b11 * a11 + b12 * a21;
a[5] = b10 * a02 + b11 * a12 + b12 * a22;
a[6] = b20 * a00 + b21 * a10 + b22 * a20;
a[7] = b20 * a01 + b21 * a11 + b22 * a21;
a[8] = b20 * a02 + b21 * a12 + b22 * a22;
return a;
}
function multiplyVec2(a, b) {
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var a00 = a[0];
var a01 = a[1];
var a10 = a[3];
var a11 = a[4];
var a20 = a[6];
var a21 = a[7];
var b0 = b.x;
var b1 = b.y;
return {
x: b0 * a00 + b1 * a10 + a20 * z,
y: b0 * a01 + b1 * a11 + a21 * z
};
}
/**
* In sigma, the graph is normalized into a [0, 1], [0, 1] square, before being given to the various renderers. This
* helps to deal with quadtree in particular.
* But at some point, we need to rescale it so that it takes the best place in the screen, i.e. we always want to see two
* nodes "touching" opposite sides of the graph, with the camera being at its default state.
*
* This function determines this ratio.
*/
function getCorrectionRatio(viewportDimensions, graphDimensions) {
var viewportRatio = viewportDimensions.height / viewportDimensions.width;
var graphRatio = graphDimensions.height / graphDimensions.width;
// If the stage and the graphs are in different directions (such as the graph being wider that tall while the stage
// is taller than wide), we can stop here to have indeed nodes touching opposite sides:
if (viewportRatio < 1 && graphRatio > 1 || viewportRatio > 1 && graphRatio < 1) {
return 1;
}
// Else, we need to fit the graph inside the stage:
// 1. If the graph is "squarer" (i.e. with a ratio closer to 1), we need to make the largest sides touch;
// 2. If the stage is "squarer", we need to make the smallest sides touch.
return Math.min(Math.max(graphRatio, 1 / graphRatio), Math.max(1 / viewportRatio, viewportRatio));
}
/**
* Function returning a matrix from the current state of the camera.
*/
function matrixFromCamera(state, viewportDimensions, graphDimensions, padding, inverse) {
// TODO: it's possible to optimize this drastically!
var angle = state.angle,
ratio = state.ratio,
x = state.x,
y = state.y;
var width = viewportDimensions.width,
height = viewportDimensions.height;
var matrix = identity();
var smallestDimension = Math.min(width, height) - 2 * padding;
var correctionRatio = getCorrectionRatio(viewportDimensions, graphDimensions);
if (!inverse) {
multiply(matrix, scale(identity(), 2 * (smallestDimension / width) * correctionRatio, 2 * (smallestDimension / height) * correctionRatio));
multiply(matrix, rotate(identity(), -angle));
multiply(matrix, scale(identity(), 1 / ratio));
multiply(matrix, translate(identity(), -x, -y));
} else {
multiply(matrix, translate(identity(), x, y));
multiply(matrix, scale(identity(), ratio));
multiply(matrix, rotate(identity(), angle));
multiply(matrix, scale(identity(), width / smallestDimension / 2 / correctionRatio, height / smallestDimension / 2 / correctionRatio));
}
return matrix;
}
/**
* All these transformations we apply on the matrix to get it rescale the graph
* as we want make it very hard to get pixel-perfect distances in WebGL. This
* function returns a factor that properly cancels the matrix effect on lengths.
*
* [jacomyal]
* To be fully honest, I can't really explain happens here... I notice that the
* following ratio works (i.e. it correctly compensates the matrix impact on all
* camera states I could try):
* > `R = size(V) / size(M * V) / W`
* as long as `M * V` is in the direction of W (ie. parallel to (Ox)). It works
* as well with H and a vector that transforms into something parallel to (Oy).
*
* Also, note that we use `angle` and not `-angle` (that would seem logical,
* since we want to anticipate the rotation), because the image is vertically
* swapped in WebGL.
*/
function getMatrixImpact(matrix, cameraState, viewportDimensions) {
var _multiplyVec = multiplyVec2(matrix, {
x: Math.cos(cameraState.angle),
y: Math.sin(cameraState.angle)
}, 0),
x = _multiplyVec.x,
y = _multiplyVec.y;
return 1 / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) / viewportDimensions.width;
}
/**
* Function returning the graph's node extent in x & y.
*/
function graphExtent(graph) {
if (!graph.order) return {
x: [0, 1],
y: [0, 1]
};
var xMin = Infinity;
var xMax = -Infinity;
var yMin = Infinity;
var yMax = -Infinity;
graph.forEachNode(function (_, attr) {
var x = attr.x,
y = attr.y;
if (x < xMin) xMin = x;
if (x > xMax) xMax = x;
if (y < yMin) yMin = y;
if (y > yMax) yMax = y;
});
return {
x: [xMin, xMax],
y: [yMin, yMax]
};
}
/**
* Check if the graph variable is a valid graph, and if sigma can render it.
*/
function validateGraph(graph) {
// check if it's a valid graphology instance
if (!isGraph__default["default"](graph)) throw new Error("Sigma: invalid graph instance.");
// check if nodes have x/y attributes
graph.forEachNode(function (key, attributes) {
if (!Number.isFinite(attributes.x) || !Number.isFinite(attributes.y)) {
throw new Error("Sigma: Coordinates of node ".concat(key, " are invalid. A node must have a numeric 'x' and 'y' attribute."));
}
});
}
/**
* Function used to create DOM elements easily.
*/
function createElement(tag, style, attributes) {
var element = document.createElement(tag);
if (style) {
for (var k in style) {
element.style[k] = style[k];
}
}
if (attributes) {
for (var _k in attributes) {
element.setAttribute(_k, attributes[_k]);
}
}
return element;
}
/**
* Function returning the browser's pixel ratio.
*/
function getPixelRatio() {
if (typeof window.devicePixelRatio !== "undefined") return window.devicePixelRatio;
return 1;
}
/**
* Function ordering the given elements in reverse z-order so they drawn
* the correct way.
*/
function zIndexOrdering(_extent, getter, elements) {
// If k is > n, we'll use a standard sort
return elements.sort(function (a, b) {
var zA = getter(a) || 0,
zB = getter(b) || 0;
if (zA < zB) return -1;
if (zA > zB) return 1;
return 0;
});
// TODO: counting sort optimization
}
/**
* Factory returning a function normalizing the given node's position & size.
*/
function createNormalizationFunction(extent) {
var _extent$x = colors._slicedToArray(extent.x, 2),
minX = _extent$x[0],
maxX = _extent$x[1],
_extent$y = colors._slicedToArray(extent.y, 2),
minY = _extent$y[0],
maxY = _extent$y[1];
var ratio = Math.max(maxX - minX, maxY - minY),
dX = (maxX + minX) / 2,
dY = (maxY + minY) / 2;
if (ratio === 0 || Math.abs(ratio) === Infinity || isNaN(ratio)) ratio = 1;
if (isNaN(dX)) dX = 0;
if (isNaN(dY)) dY = 0;
var fn = function fn(data) {
return {
x: 0.5 + (data.x - dX) / ratio,
y: 0.5 + (data.y - dY) / ratio
};
};
// TODO: possibility to apply this in batch over array of indices
fn.applyTo = function (data) {
data.x = 0.5 + (data.x - dX) / ratio;
data.y = 0.5 + (data.y - dY) / ratio;
};
fn.inverse = function (data) {
return {
x: dX + ratio * (data.x - 0.5),
y: dY + ratio * (data.y - 0.5)
};
};
fn.ratio = ratio;
return fn;
}
exports.ANIMATE_DEFAULTS = ANIMATE_DEFAULTS;
exports.animateNodes = animateNodes;
exports.createElement = createElement;
exports.createNormalizationFunction = createNormalizationFunction;
exports.cubicIn = cubicIn;
exports.cubicInOut = cubicInOut;
exports.cubicOut = cubicOut;
exports.easings = easings;
exports.getCorrectionRatio = getCorrectionRatio;
exports.getMatrixImpact = getMatrixImpact;
exports.getPixelRatio = getPixelRatio;
exports.graphExtent = graphExtent;
exports.identity = identity;
exports.linear = linear;
exports.matrixFromCamera = matrixFromCamera;
exports.multiply = multiply;
exports.multiplyVec2 = multiplyVec2;
exports.quadraticIn = quadraticIn;
exports.quadraticInOut = quadraticInOut;
exports.quadraticOut = quadraticOut;
exports.rotate = rotate;
exports.scale = scale;
exports.translate = translate;
exports.validateGraph = validateGraph;
exports.zIndexOrdering = zIndexOrdering;

View File

@@ -0,0 +1,390 @@
'use strict';
var isGraph = require('graphology-utils/is-graph');
var colors = require('./colors-ee2e2828.cjs.prod.js');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var isGraph__default = /*#__PURE__*/_interopDefault(isGraph);
var linear = function linear(k) {
return k;
};
var quadraticIn = function quadraticIn(k) {
return k * k;
};
var quadraticOut = function quadraticOut(k) {
return k * (2 - k);
};
var quadraticInOut = function quadraticInOut(k) {
if ((k *= 2) < 1) return 0.5 * k * k;
return -0.5 * (--k * (k - 2) - 1);
};
var cubicIn = function cubicIn(k) {
return k * k * k;
};
var cubicOut = function cubicOut(k) {
return --k * k * k + 1;
};
var cubicInOut = function cubicInOut(k) {
if ((k *= 2) < 1) return 0.5 * k * k * k;
return 0.5 * ((k -= 2) * k * k + 2);
};
var easings = {
linear: linear,
quadraticIn: quadraticIn,
quadraticOut: quadraticOut,
quadraticInOut: quadraticInOut,
cubicIn: cubicIn,
cubicOut: cubicOut,
cubicInOut: cubicInOut
};
/**
* Defaults.
*/
var ANIMATE_DEFAULTS = {
easing: "quadraticInOut",
duration: 150
};
/**
* Function used to animate the nodes.
*/
function animateNodes(graph, targets, opts, callback) {
var options = Object.assign({}, ANIMATE_DEFAULTS, opts);
var easing = typeof options.easing === "function" ? options.easing : easings[options.easing];
var start = Date.now();
var startPositions = {};
for (var node in targets) {
var attrs = targets[node];
startPositions[node] = {};
for (var _k in attrs) startPositions[node][_k] = graph.getNodeAttribute(node, _k);
}
var frame = null;
var _step = function step() {
frame = null;
var p = (Date.now() - start) / options.duration;
if (p >= 1) {
// Animation is done
for (var _node in targets) {
var _attrs = targets[_node];
// We use given values to avoid precision issues and for convenience
for (var _k2 in _attrs) graph.setNodeAttribute(_node, _k2, _attrs[_k2]);
}
if (typeof callback === "function") callback();
return;
}
p = easing(p);
for (var _node2 in targets) {
var _attrs2 = targets[_node2];
var s = startPositions[_node2];
for (var _k3 in _attrs2) graph.setNodeAttribute(_node2, _k3, _attrs2[_k3] * p + s[_k3] * (1 - p));
}
frame = requestAnimationFrame(_step);
};
_step();
return function () {
if (frame) cancelAnimationFrame(frame);
};
}
function identity() {
return Float32Array.of(1, 0, 0, 0, 1, 0, 0, 0, 1);
}
// TODO: optimize
function scale(m, x, y) {
m[0] = x;
m[4] = typeof y === "number" ? y : x;
return m;
}
function rotate(m, r) {
var s = Math.sin(r),
c = Math.cos(r);
m[0] = c;
m[1] = s;
m[3] = -s;
m[4] = c;
return m;
}
function translate(m, x, y) {
m[6] = x;
m[7] = y;
return m;
}
function multiply(a, b) {
var a00 = a[0],
a01 = a[1],
a02 = a[2];
var a10 = a[3],
a11 = a[4],
a12 = a[5];
var a20 = a[6],
a21 = a[7],
a22 = a[8];
var b00 = b[0],
b01 = b[1],
b02 = b[2];
var b10 = b[3],
b11 = b[4],
b12 = b[5];
var b20 = b[6],
b21 = b[7],
b22 = b[8];
a[0] = b00 * a00 + b01 * a10 + b02 * a20;
a[1] = b00 * a01 + b01 * a11 + b02 * a21;
a[2] = b00 * a02 + b01 * a12 + b02 * a22;
a[3] = b10 * a00 + b11 * a10 + b12 * a20;
a[4] = b10 * a01 + b11 * a11 + b12 * a21;
a[5] = b10 * a02 + b11 * a12 + b12 * a22;
a[6] = b20 * a00 + b21 * a10 + b22 * a20;
a[7] = b20 * a01 + b21 * a11 + b22 * a21;
a[8] = b20 * a02 + b21 * a12 + b22 * a22;
return a;
}
function multiplyVec2(a, b) {
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var a00 = a[0];
var a01 = a[1];
var a10 = a[3];
var a11 = a[4];
var a20 = a[6];
var a21 = a[7];
var b0 = b.x;
var b1 = b.y;
return {
x: b0 * a00 + b1 * a10 + a20 * z,
y: b0 * a01 + b1 * a11 + a21 * z
};
}
/**
* In sigma, the graph is normalized into a [0, 1], [0, 1] square, before being given to the various renderers. This
* helps to deal with quadtree in particular.
* But at some point, we need to rescale it so that it takes the best place in the screen, i.e. we always want to see two
* nodes "touching" opposite sides of the graph, with the camera being at its default state.
*
* This function determines this ratio.
*/
function getCorrectionRatio(viewportDimensions, graphDimensions) {
var viewportRatio = viewportDimensions.height / viewportDimensions.width;
var graphRatio = graphDimensions.height / graphDimensions.width;
// If the stage and the graphs are in different directions (such as the graph being wider that tall while the stage
// is taller than wide), we can stop here to have indeed nodes touching opposite sides:
if (viewportRatio < 1 && graphRatio > 1 || viewportRatio > 1 && graphRatio < 1) {
return 1;
}
// Else, we need to fit the graph inside the stage:
// 1. If the graph is "squarer" (i.e. with a ratio closer to 1), we need to make the largest sides touch;
// 2. If the stage is "squarer", we need to make the smallest sides touch.
return Math.min(Math.max(graphRatio, 1 / graphRatio), Math.max(1 / viewportRatio, viewportRatio));
}
/**
* Function returning a matrix from the current state of the camera.
*/
function matrixFromCamera(state, viewportDimensions, graphDimensions, padding, inverse) {
// TODO: it's possible to optimize this drastically!
var angle = state.angle,
ratio = state.ratio,
x = state.x,
y = state.y;
var width = viewportDimensions.width,
height = viewportDimensions.height;
var matrix = identity();
var smallestDimension = Math.min(width, height) - 2 * padding;
var correctionRatio = getCorrectionRatio(viewportDimensions, graphDimensions);
if (!inverse) {
multiply(matrix, scale(identity(), 2 * (smallestDimension / width) * correctionRatio, 2 * (smallestDimension / height) * correctionRatio));
multiply(matrix, rotate(identity(), -angle));
multiply(matrix, scale(identity(), 1 / ratio));
multiply(matrix, translate(identity(), -x, -y));
} else {
multiply(matrix, translate(identity(), x, y));
multiply(matrix, scale(identity(), ratio));
multiply(matrix, rotate(identity(), angle));
multiply(matrix, scale(identity(), width / smallestDimension / 2 / correctionRatio, height / smallestDimension / 2 / correctionRatio));
}
return matrix;
}
/**
* All these transformations we apply on the matrix to get it rescale the graph
* as we want make it very hard to get pixel-perfect distances in WebGL. This
* function returns a factor that properly cancels the matrix effect on lengths.
*
* [jacomyal]
* To be fully honest, I can't really explain happens here... I notice that the
* following ratio works (i.e. it correctly compensates the matrix impact on all
* camera states I could try):
* > `R = size(V) / size(M * V) / W`
* as long as `M * V` is in the direction of W (ie. parallel to (Ox)). It works
* as well with H and a vector that transforms into something parallel to (Oy).
*
* Also, note that we use `angle` and not `-angle` (that would seem logical,
* since we want to anticipate the rotation), because the image is vertically
* swapped in WebGL.
*/
function getMatrixImpact(matrix, cameraState, viewportDimensions) {
var _multiplyVec = multiplyVec2(matrix, {
x: Math.cos(cameraState.angle),
y: Math.sin(cameraState.angle)
}, 0),
x = _multiplyVec.x,
y = _multiplyVec.y;
return 1 / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) / viewportDimensions.width;
}
/**
* Function returning the graph's node extent in x & y.
*/
function graphExtent(graph) {
if (!graph.order) return {
x: [0, 1],
y: [0, 1]
};
var xMin = Infinity;
var xMax = -Infinity;
var yMin = Infinity;
var yMax = -Infinity;
graph.forEachNode(function (_, attr) {
var x = attr.x,
y = attr.y;
if (x < xMin) xMin = x;
if (x > xMax) xMax = x;
if (y < yMin) yMin = y;
if (y > yMax) yMax = y;
});
return {
x: [xMin, xMax],
y: [yMin, yMax]
};
}
/**
* Check if the graph variable is a valid graph, and if sigma can render it.
*/
function validateGraph(graph) {
// check if it's a valid graphology instance
if (!isGraph__default["default"](graph)) throw new Error("Sigma: invalid graph instance.");
// check if nodes have x/y attributes
graph.forEachNode(function (key, attributes) {
if (!Number.isFinite(attributes.x) || !Number.isFinite(attributes.y)) {
throw new Error("Sigma: Coordinates of node ".concat(key, " are invalid. A node must have a numeric 'x' and 'y' attribute."));
}
});
}
/**
* Function used to create DOM elements easily.
*/
function createElement(tag, style, attributes) {
var element = document.createElement(tag);
if (style) {
for (var k in style) {
element.style[k] = style[k];
}
}
if (attributes) {
for (var _k in attributes) {
element.setAttribute(_k, attributes[_k]);
}
}
return element;
}
/**
* Function returning the browser's pixel ratio.
*/
function getPixelRatio() {
if (typeof window.devicePixelRatio !== "undefined") return window.devicePixelRatio;
return 1;
}
/**
* Function ordering the given elements in reverse z-order so they drawn
* the correct way.
*/
function zIndexOrdering(_extent, getter, elements) {
// If k is > n, we'll use a standard sort
return elements.sort(function (a, b) {
var zA = getter(a) || 0,
zB = getter(b) || 0;
if (zA < zB) return -1;
if (zA > zB) return 1;
return 0;
});
// TODO: counting sort optimization
}
/**
* Factory returning a function normalizing the given node's position & size.
*/
function createNormalizationFunction(extent) {
var _extent$x = colors._slicedToArray(extent.x, 2),
minX = _extent$x[0],
maxX = _extent$x[1],
_extent$y = colors._slicedToArray(extent.y, 2),
minY = _extent$y[0],
maxY = _extent$y[1];
var ratio = Math.max(maxX - minX, maxY - minY),
dX = (maxX + minX) / 2,
dY = (maxY + minY) / 2;
if (ratio === 0 || Math.abs(ratio) === Infinity || isNaN(ratio)) ratio = 1;
if (isNaN(dX)) dX = 0;
if (isNaN(dY)) dY = 0;
var fn = function fn(data) {
return {
x: 0.5 + (data.x - dX) / ratio,
y: 0.5 + (data.y - dY) / ratio
};
};
// TODO: possibility to apply this in batch over array of indices
fn.applyTo = function (data) {
data.x = 0.5 + (data.x - dX) / ratio;
data.y = 0.5 + (data.y - dY) / ratio;
};
fn.inverse = function (data) {
return {
x: dX + ratio * (data.x - 0.5),
y: dY + ratio * (data.y - 0.5)
};
};
fn.ratio = ratio;
return fn;
}
exports.ANIMATE_DEFAULTS = ANIMATE_DEFAULTS;
exports.animateNodes = animateNodes;
exports.createElement = createElement;
exports.createNormalizationFunction = createNormalizationFunction;
exports.cubicIn = cubicIn;
exports.cubicInOut = cubicInOut;
exports.cubicOut = cubicOut;
exports.easings = easings;
exports.getCorrectionRatio = getCorrectionRatio;
exports.getMatrixImpact = getMatrixImpact;
exports.getPixelRatio = getPixelRatio;
exports.graphExtent = graphExtent;
exports.identity = identity;
exports.linear = linear;
exports.matrixFromCamera = matrixFromCamera;
exports.multiply = multiply;
exports.multiplyVec2 = multiplyVec2;
exports.quadraticIn = quadraticIn;
exports.quadraticInOut = quadraticInOut;
exports.quadraticOut = quadraticOut;
exports.rotate = rotate;
exports.scale = scale;
exports.translate = translate;
exports.validateGraph = validateGraph;
exports.zIndexOrdering = zIndexOrdering;

View File

@@ -0,0 +1,360 @@
import isGraph from 'graphology-utils/is-graph';
import { _ as _slicedToArray } from './colors-beb06eb2.esm.js';
var linear = function linear(k) {
return k;
};
var quadraticIn = function quadraticIn(k) {
return k * k;
};
var quadraticOut = function quadraticOut(k) {
return k * (2 - k);
};
var quadraticInOut = function quadraticInOut(k) {
if ((k *= 2) < 1) return 0.5 * k * k;
return -0.5 * (--k * (k - 2) - 1);
};
var cubicIn = function cubicIn(k) {
return k * k * k;
};
var cubicOut = function cubicOut(k) {
return --k * k * k + 1;
};
var cubicInOut = function cubicInOut(k) {
if ((k *= 2) < 1) return 0.5 * k * k * k;
return 0.5 * ((k -= 2) * k * k + 2);
};
var easings = {
linear: linear,
quadraticIn: quadraticIn,
quadraticOut: quadraticOut,
quadraticInOut: quadraticInOut,
cubicIn: cubicIn,
cubicOut: cubicOut,
cubicInOut: cubicInOut
};
/**
* Defaults.
*/
var ANIMATE_DEFAULTS = {
easing: "quadraticInOut",
duration: 150
};
/**
* Function used to animate the nodes.
*/
function animateNodes(graph, targets, opts, callback) {
var options = Object.assign({}, ANIMATE_DEFAULTS, opts);
var easing = typeof options.easing === "function" ? options.easing : easings[options.easing];
var start = Date.now();
var startPositions = {};
for (var node in targets) {
var attrs = targets[node];
startPositions[node] = {};
for (var _k in attrs) startPositions[node][_k] = graph.getNodeAttribute(node, _k);
}
var frame = null;
var _step = function step() {
frame = null;
var p = (Date.now() - start) / options.duration;
if (p >= 1) {
// Animation is done
for (var _node in targets) {
var _attrs = targets[_node];
// We use given values to avoid precision issues and for convenience
for (var _k2 in _attrs) graph.setNodeAttribute(_node, _k2, _attrs[_k2]);
}
if (typeof callback === "function") callback();
return;
}
p = easing(p);
for (var _node2 in targets) {
var _attrs2 = targets[_node2];
var s = startPositions[_node2];
for (var _k3 in _attrs2) graph.setNodeAttribute(_node2, _k3, _attrs2[_k3] * p + s[_k3] * (1 - p));
}
frame = requestAnimationFrame(_step);
};
_step();
return function () {
if (frame) cancelAnimationFrame(frame);
};
}
function identity() {
return Float32Array.of(1, 0, 0, 0, 1, 0, 0, 0, 1);
}
// TODO: optimize
function scale(m, x, y) {
m[0] = x;
m[4] = typeof y === "number" ? y : x;
return m;
}
function rotate(m, r) {
var s = Math.sin(r),
c = Math.cos(r);
m[0] = c;
m[1] = s;
m[3] = -s;
m[4] = c;
return m;
}
function translate(m, x, y) {
m[6] = x;
m[7] = y;
return m;
}
function multiply(a, b) {
var a00 = a[0],
a01 = a[1],
a02 = a[2];
var a10 = a[3],
a11 = a[4],
a12 = a[5];
var a20 = a[6],
a21 = a[7],
a22 = a[8];
var b00 = b[0],
b01 = b[1],
b02 = b[2];
var b10 = b[3],
b11 = b[4],
b12 = b[5];
var b20 = b[6],
b21 = b[7],
b22 = b[8];
a[0] = b00 * a00 + b01 * a10 + b02 * a20;
a[1] = b00 * a01 + b01 * a11 + b02 * a21;
a[2] = b00 * a02 + b01 * a12 + b02 * a22;
a[3] = b10 * a00 + b11 * a10 + b12 * a20;
a[4] = b10 * a01 + b11 * a11 + b12 * a21;
a[5] = b10 * a02 + b11 * a12 + b12 * a22;
a[6] = b20 * a00 + b21 * a10 + b22 * a20;
a[7] = b20 * a01 + b21 * a11 + b22 * a21;
a[8] = b20 * a02 + b21 * a12 + b22 * a22;
return a;
}
function multiplyVec2(a, b) {
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var a00 = a[0];
var a01 = a[1];
var a10 = a[3];
var a11 = a[4];
var a20 = a[6];
var a21 = a[7];
var b0 = b.x;
var b1 = b.y;
return {
x: b0 * a00 + b1 * a10 + a20 * z,
y: b0 * a01 + b1 * a11 + a21 * z
};
}
/**
* In sigma, the graph is normalized into a [0, 1], [0, 1] square, before being given to the various renderers. This
* helps to deal with quadtree in particular.
* But at some point, we need to rescale it so that it takes the best place in the screen, i.e. we always want to see two
* nodes "touching" opposite sides of the graph, with the camera being at its default state.
*
* This function determines this ratio.
*/
function getCorrectionRatio(viewportDimensions, graphDimensions) {
var viewportRatio = viewportDimensions.height / viewportDimensions.width;
var graphRatio = graphDimensions.height / graphDimensions.width;
// If the stage and the graphs are in different directions (such as the graph being wider that tall while the stage
// is taller than wide), we can stop here to have indeed nodes touching opposite sides:
if (viewportRatio < 1 && graphRatio > 1 || viewportRatio > 1 && graphRatio < 1) {
return 1;
}
// Else, we need to fit the graph inside the stage:
// 1. If the graph is "squarer" (i.e. with a ratio closer to 1), we need to make the largest sides touch;
// 2. If the stage is "squarer", we need to make the smallest sides touch.
return Math.min(Math.max(graphRatio, 1 / graphRatio), Math.max(1 / viewportRatio, viewportRatio));
}
/**
* Function returning a matrix from the current state of the camera.
*/
function matrixFromCamera(state, viewportDimensions, graphDimensions, padding, inverse) {
// TODO: it's possible to optimize this drastically!
var angle = state.angle,
ratio = state.ratio,
x = state.x,
y = state.y;
var width = viewportDimensions.width,
height = viewportDimensions.height;
var matrix = identity();
var smallestDimension = Math.min(width, height) - 2 * padding;
var correctionRatio = getCorrectionRatio(viewportDimensions, graphDimensions);
if (!inverse) {
multiply(matrix, scale(identity(), 2 * (smallestDimension / width) * correctionRatio, 2 * (smallestDimension / height) * correctionRatio));
multiply(matrix, rotate(identity(), -angle));
multiply(matrix, scale(identity(), 1 / ratio));
multiply(matrix, translate(identity(), -x, -y));
} else {
multiply(matrix, translate(identity(), x, y));
multiply(matrix, scale(identity(), ratio));
multiply(matrix, rotate(identity(), angle));
multiply(matrix, scale(identity(), width / smallestDimension / 2 / correctionRatio, height / smallestDimension / 2 / correctionRatio));
}
return matrix;
}
/**
* All these transformations we apply on the matrix to get it rescale the graph
* as we want make it very hard to get pixel-perfect distances in WebGL. This
* function returns a factor that properly cancels the matrix effect on lengths.
*
* [jacomyal]
* To be fully honest, I can't really explain happens here... I notice that the
* following ratio works (i.e. it correctly compensates the matrix impact on all
* camera states I could try):
* > `R = size(V) / size(M * V) / W`
* as long as `M * V` is in the direction of W (ie. parallel to (Ox)). It works
* as well with H and a vector that transforms into something parallel to (Oy).
*
* Also, note that we use `angle` and not `-angle` (that would seem logical,
* since we want to anticipate the rotation), because the image is vertically
* swapped in WebGL.
*/
function getMatrixImpact(matrix, cameraState, viewportDimensions) {
var _multiplyVec = multiplyVec2(matrix, {
x: Math.cos(cameraState.angle),
y: Math.sin(cameraState.angle)
}, 0),
x = _multiplyVec.x,
y = _multiplyVec.y;
return 1 / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) / viewportDimensions.width;
}
/**
* Function returning the graph's node extent in x & y.
*/
function graphExtent(graph) {
if (!graph.order) return {
x: [0, 1],
y: [0, 1]
};
var xMin = Infinity;
var xMax = -Infinity;
var yMin = Infinity;
var yMax = -Infinity;
graph.forEachNode(function (_, attr) {
var x = attr.x,
y = attr.y;
if (x < xMin) xMin = x;
if (x > xMax) xMax = x;
if (y < yMin) yMin = y;
if (y > yMax) yMax = y;
});
return {
x: [xMin, xMax],
y: [yMin, yMax]
};
}
/**
* Check if the graph variable is a valid graph, and if sigma can render it.
*/
function validateGraph(graph) {
// check if it's a valid graphology instance
if (!isGraph(graph)) throw new Error("Sigma: invalid graph instance.");
// check if nodes have x/y attributes
graph.forEachNode(function (key, attributes) {
if (!Number.isFinite(attributes.x) || !Number.isFinite(attributes.y)) {
throw new Error("Sigma: Coordinates of node ".concat(key, " are invalid. A node must have a numeric 'x' and 'y' attribute."));
}
});
}
/**
* Function used to create DOM elements easily.
*/
function createElement(tag, style, attributes) {
var element = document.createElement(tag);
if (style) {
for (var k in style) {
element.style[k] = style[k];
}
}
if (attributes) {
for (var _k in attributes) {
element.setAttribute(_k, attributes[_k]);
}
}
return element;
}
/**
* Function returning the browser's pixel ratio.
*/
function getPixelRatio() {
if (typeof window.devicePixelRatio !== "undefined") return window.devicePixelRatio;
return 1;
}
/**
* Function ordering the given elements in reverse z-order so they drawn
* the correct way.
*/
function zIndexOrdering(_extent, getter, elements) {
// If k is > n, we'll use a standard sort
return elements.sort(function (a, b) {
var zA = getter(a) || 0,
zB = getter(b) || 0;
if (zA < zB) return -1;
if (zA > zB) return 1;
return 0;
});
// TODO: counting sort optimization
}
/**
* Factory returning a function normalizing the given node's position & size.
*/
function createNormalizationFunction(extent) {
var _extent$x = _slicedToArray(extent.x, 2),
minX = _extent$x[0],
maxX = _extent$x[1],
_extent$y = _slicedToArray(extent.y, 2),
minY = _extent$y[0],
maxY = _extent$y[1];
var ratio = Math.max(maxX - minX, maxY - minY),
dX = (maxX + minX) / 2,
dY = (maxY + minY) / 2;
if (ratio === 0 || Math.abs(ratio) === Infinity || isNaN(ratio)) ratio = 1;
if (isNaN(dX)) dX = 0;
if (isNaN(dY)) dY = 0;
var fn = function fn(data) {
return {
x: 0.5 + (data.x - dX) / ratio,
y: 0.5 + (data.y - dY) / ratio
};
};
// TODO: possibility to apply this in batch over array of indices
fn.applyTo = function (data) {
data.x = 0.5 + (data.x - dX) / ratio;
data.y = 0.5 + (data.y - dY) / ratio;
};
fn.inverse = function (data) {
return {
x: dX + ratio * (data.x - 0.5),
y: dY + ratio * (data.y - 0.5)
};
};
fn.ratio = ratio;
return fn;
}
export { ANIMATE_DEFAULTS as A, getMatrixImpact as a, createElement as b, createNormalizationFunction as c, getPixelRatio as d, easings as e, multiplyVec2 as f, graphExtent as g, animateNodes as h, identity as i, getCorrectionRatio as j, quadraticOut as k, linear as l, matrixFromCamera as m, quadraticInOut as n, cubicIn as o, cubicOut as p, quadraticIn as q, cubicInOut as r, scale as s, rotate as t, translate as u, validateGraph as v, multiply as w, zIndexOrdering as z };

3
web/node_modules/sigma/dist/sigma.cjs.d.mts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from "./declarations/src/index.js";
export { _default as default } from "./sigma.cjs.default.js";
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbWEuY2pzLmQubXRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==

3
web/node_modules/sigma/dist/sigma.cjs.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from "./declarations/src/index.js";
export { default } from "./declarations/src/index.js";
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbWEuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9

1
web/node_modules/sigma/dist/sigma.cjs.default.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { default as _default } from "./declarations/src/index.js"

1
web/node_modules/sigma/dist/sigma.cjs.default.js generated vendored Normal file
View File

@@ -0,0 +1 @@
exports._default = require("./sigma.cjs.js").default;

3676
web/node_modules/sigma/dist/sigma.cjs.dev.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

7
web/node_modules/sigma/dist/sigma.cjs.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./sigma.cjs.prod.js");
} else {
module.exports = require("./sigma.cjs.dev.js");
}

7
web/node_modules/sigma/dist/sigma.cjs.mjs generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export {
Camera,
MouseCaptor,
Sigma,
TouchCaptor
} from "./sigma.cjs.js";
export { _default as default } from "./sigma.cjs.default.js";

3676
web/node_modules/sigma/dist/sigma.cjs.prod.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

3668
web/node_modules/sigma/dist/sigma.esm.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1369
web/node_modules/sigma/dist/sigma.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long