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

@sayari/trellis

Package Overview
Dependencies
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sayari/trellis - npm Package Compare versions

Comparing version 0.3.0-rc.10 to 0.3.0-rc.11

2

layout/hierarchy/index.d.ts

@@ -15,3 +15,3 @@ import { HierarchyPointNode } from 'd3-hierarchy';

};
export declare const Layout: () => <N extends Node, E extends Edge>(root: string, graph: {
export declare const Layout: () => <N extends Node, E extends Edge>(rootId: string, graph: {
nodes: N[];

@@ -18,0 +18,0 @@ edges: E[];

@@ -121,5 +121,51 @@ "use strict";

var hierarchyToGraph = function (hierarchy) { return _hierarchyToGraph(hierarchy, {}); };
var containsSubgraphNode = function (nodes, id) {
var e_4, _a;
try {
for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
if (node.id === id)
return true;
if (node.subgraph !== undefined) {
var exists = containsSubgraphNode(node.subgraph.nodes, id);
if (exists)
return true;
}
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
}
finally { if (e_4) throw e_4.error; }
}
return false;
};
var findAncestor = function (nodes, id) {
var e_5, _a;
try {
for (var nodes_2 = __values(nodes), nodes_2_1 = nodes_2.next(); !nodes_2_1.done; nodes_2_1 = nodes_2.next()) {
var node = nodes_2_1.value;
if (node.id === id)
return node.id;
if (node.subgraph !== undefined) {
var exists = containsSubgraphNode(node.subgraph.nodes, id);
if (exists)
return node.id;
}
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (nodes_2_1 && !nodes_2_1.done && (_a = nodes_2.return)) _a.call(nodes_2);
}
finally { if (e_5) throw e_5.error; }
}
return undefined;
};
var Layout = function () {
return function (root, graph) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
return function (rootId, graph) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
var edgeIndex = graph.edges.reduce(function (edgeIndex, edge) {

@@ -136,12 +182,13 @@ if (edgeIndex[edge.source] === undefined) {

}, {});
var root = edgeIndex[rootId] === undefined ? ((_a = findAncestor(graph.nodes, rootId)) !== null && _a !== void 0 ? _a : rootId) : rootId;
if (edgeIndex[root] === undefined) {
return { nodes: graph.nodes, edges: graph.edges };
}
var layout = ((_a = graph.options) === null || _a === void 0 ? void 0 : _a.size) !== undefined ?
var layout = ((_b = graph.options) === null || _b === void 0 ? void 0 : _b.size) !== undefined ?
d3_hierarchy_1.tree().size(graph.options.size) :
d3_hierarchy_1.tree().nodeSize((_c = (_b = graph.options) === null || _b === void 0 ? void 0 : _b.nodeSize) !== null && _c !== void 0 ? _c : DEFAULT_NODE_SIZE);
if (((_d = graph.options) === null || _d === void 0 ? void 0 : _d.separation) !== undefined) {
d3_hierarchy_1.tree().nodeSize((_d = (_c = graph.options) === null || _c === void 0 ? void 0 : _c.nodeSize) !== null && _d !== void 0 ? _d : DEFAULT_NODE_SIZE);
if (((_e = graph.options) === null || _e === void 0 ? void 0 : _e.separation) !== undefined) {
layout.separation(graph.options.separation);
}
var positionedDataById = hierarchyToGraph(layout(d3_hierarchy_1.hierarchy(((_e = graph.options) === null || _e === void 0 ? void 0 : _e.bfs) !== false ?
var positionedDataById = hierarchyToGraph(layout(d3_hierarchy_1.hierarchy(((_f = graph.options) === null || _f === void 0 ? void 0 : _f.bfs) !== false ?
graphToBFSHierarchy(edgeIndex, root) :

@@ -157,5 +204,5 @@ graphToDFSHierarchy(edgeIndex, root))));

// )
var _l = (_f = graph.nodes.find(function (node) { return node.id === root; })) !== null && _f !== void 0 ? _f : { x: undefined, y: undefined }, x = _l.x, y = _l.y;
var xOffset = ((_h = (_g = graph.options) === null || _g === void 0 ? void 0 : _g.x) !== null && _h !== void 0 ? _h : 0) + (x !== null && x !== void 0 ? x : 0);
var yOffset = ((_k = (_j = graph.options) === null || _j === void 0 ? void 0 : _j.y) !== null && _k !== void 0 ? _k : 0) - (y !== null && y !== void 0 ? y : 0);
var _m = (_g = graph.nodes.find(function (node) { return node.id === root; })) !== null && _g !== void 0 ? _g : { x: undefined, y: undefined }, x = _m.x, y = _m.y;
var xOffset = ((_j = (_h = graph.options) === null || _h === void 0 ? void 0 : _h.x) !== null && _j !== void 0 ? _j : 0) + (x !== null && x !== void 0 ? x : 0);
var yOffset = ((_l = (_k = graph.options) === null || _k === void 0 ? void 0 : _k.y) !== null && _l !== void 0 ? _l : 0) - (y !== null && y !== void 0 ? y : 0);
return {

@@ -162,0 +209,0 @@ edges: graph.edges,

{
"name": "@sayari/trellis",
"version": "0.3.0-rc.10",
"version": "0.3.0-rc.11",
"description": "High-performance network visualization library, rendering to WebGL as well as other targets",

@@ -5,0 +5,0 @@ "main": "./index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc