
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
cytoscape-html-node
Advanced tools
This extension allows for the creation of html in cytoscape nodes that can change based on zoom level.
This extension allows for the creation of html in cytoscape nodes that can change based on zoom level.
This extension was built as a use case of https://github.com/kaluginserg/cytoscape-node-html-label.
Download the library:
npm install cytoscape-html-node
Import the library as appropriate for your project:
ES import:
import cytoscape from 'cytoscape';
import { register as htmlnode } from 'cytoscape-html-node';
cytoscape.use(htmlnode);
CommonJS require:
let cytoscape = require('cytoscape');
let htmlnode = require('cytoscape-html-node');
cytoscape.use(htmlnode);
AMD:
require(['cytoscape', 'cytoscape-html-node'], function (cytoscape, htmlnode) {
htmlnode(cytoscape);
});
example/src/example.js
.import cytoscape from 'cytoscape';
import { register as htmlnode } from 'cytoscape-html-node';
// register extensions
cytoscape.use(htmlnode);
let cy = cytoscape({
container: document.getElementById('cy'),
layout: {
name: 'random',
},
style: [
{
selector: '.htmlNodeBaseStyle',
style: {
'background-color': 'lightgrey',
},
},
{
selector: '.htmlNodeAltStyle',
style: {
'background-color': 'darkblue',
},
},
],
elements: [
{
group: 'nodes',
data: {
id: 'a1',
shortSum: 'Short summary.',
mediumSum: 'This a medium summary.',
longSum: 'This is a much longer summary.',
},
},
{
group: 'nodes',
data: {
id: 'a2',
shortSum: 'Short summary.',
mediumSum: 'This a medium summary.',
longSum: 'This is a much longer summary.',
},
},
{
group: 'nodes',
data: {
id: 'a3',
shortSum: 'Short summary.',
mediumSum: 'This a medium summary.',
longSum: 'This is a much longer summary.',
},
},
{
group: 'nodes',
data: {
id: 'a4',
shortSum: 'Short summary.',
mediumSum: 'This a medium summary.',
longSum: 'This is a much longer summary.',
},
},
],
});
const htmlnode = cy.htmlnode();
htmlnode.createHtmlNode(cytoscape, cy, {
person: {
query: "[type = 'person']",
template: [
{
zoomRange: [0.3, 1],
template: {
html: `<div id="htmlLabel:#{data.id}">
<div class="largeFont">#{data.shortSum}</div>
</div>`,
cssClass: 'htmlCard',
},
},
{
zoomRange: [1, 3],
template: {
html: `<div id="htmlLabel:#{data.id}">
<div class="mediumFont">#{data.mediumSum}</div>
</div>`,
cssClass: 'htmlCard',
},
},
{
zoomRange: [3, 100],
template: {
html: `<div id="htmlLabel:#{data.id}" class="cardField">
<div class="smallFont">#{data.longSum}</div>
</div>`,
cssClass: 'htmlCard',
},
},
],
},
event: {
query: "[type = 'event']",
template: [
{
zoomRange: [0.3, 1],
template: {
html: `<div id="htmlLabel:#{data.id}">
<div class="smallFont">#{data.shortEventInfo}</div>
</div>`,
cssClass: 'htmlEvent',
},
},
{
zoomRange: [1, 3],
template: {
html: `<div id="htmlLabel:#{data.id}">
<div class="mediumFont">#{data.mediumEventInfo}</div>
</div>`,
cssClass: 'htmlEvent',
},
},
{
zoomRange: [3, 100],
template: {
html: `<div id="htmlLabel:#{data.id}">
<div class="smallFont">#{data.longEventInfo}</div>
</div>`,
cssClass: 'htmlEvent',
},
},
],
},
});
The extension call should occur only once. All templates should be specified in that call, even if they are not immediately needed.
query
: Accepts any cytoscape query. Specifies which node(s) template
will apply to. Nodes added after the intial extension call that match the query
will have html
applied to them.
htmlNodeBaseStyle
: The style of the cytoscape node(s) when zoom has not passed the minimum zoomRange
value.
htmlNodeAltStyle
: The style of the cytoscape node(s) when zoom has passed the minimum zoomRange
value.
zoomRange
: The zoom range for which the template html is used. The values for each zoomRange
within a query
should be continuous with ascending values. The minimum value of all zoomRange
within a query
specifies when to toggle between altColor
and defaultColor
. The largest zoomRange
should be arbitrarily large.
Cytoscape data can be accessed within html using #{data.prop}
where prop is some cytoscape node data property.
The parent div
should follow: <div id="htmlLabel:#{data.id}"></div>
The width and height of the parent html-node div
should be specified.
The parent html-node div
should be centered.
Either content should not exceed the height of the parent html-node div
or overflow should be managed.
FAQs
This extension allows for the creation of html in cytoscape nodes that can change based on zoom level.
The npm package cytoscape-html-node receives a total of 538 weekly downloads. As such, cytoscape-html-node popularity was classified as not popular.
We found that cytoscape-html-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.