Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@byai/topology
Advanced tools
yarn add @byai/topology
yarn
yarn start
yarn test
见demo
name | type | default | description |
---|---|---|---|
data | object | { nodes: []; lines: [] } | 数据 |
lineColor | object | {} | 线条颜色映射对象 eg: {'锚点1': '#82BEFF', '锚点2': '#FFA39E'} |
lineTextColor | object | {} | 线条上文字颜色映射对象 eg: {'锚点1': '#82BEFF', '锚点2': '#FFA39E'} |
lineOffsetY | number | 0 | 线条起始点向上偏移量 |
startPointAnchorId | string | 保持所有线条起始点与 startPointAnchorId 线条一致 | |
showBar | bool | true | 是否显示工具栏 |
canConnectMultiLines | bool | false | 控制一个锚点是否可以连接多条线 |
overlap | bool | false | 是否允许节点覆盖,默认允许,设置 true 时不允许 |
overlapCallback | () => void | overlap 为 true 时的回调 | |
overlapOffset | {} | {offsetX: 0, offsetY: 0} | overlap 为 true 时,节点的 x,y 偏移量 |
customPostionHeight | number | 0 | 未设置 customPostionHeight 画布默认居中展示,当设置 customPostionHeight 时,画布距离顶部 customPostionHeight |
readOnly | bool | false | 只读模式,为true时不可编辑 |
autoLayout | bool | false | 自动布局,当数据中没有position属性时将自动计算布局。 |
renderTreeNode | (node,decorators) => ReactNode | - | 子节点render方法,接收节点数据,返回JSX。 |
getInstance | (instance: Topology) => void | - | 返回组件实例,用于调用组件内部的方法。 |
onChange | (data, changeType) => void | - | 数据发成改变时触发,changeType为改变的类型 |
onSelect | (data) => void | - | 选中数据时触发,返回当前选中的数据(包含节点、线段) |
sortChildren | (parent, children) => sortedChildren | - | 子节点排序回调,可选,默认无。 |
node options 中 一些可配置参数
name | type | default | description |
---|---|---|---|
id | string | - | 节点id |
canDrag | boolean | true | 控制节点是否可拖拽 |
dragChild | boolean | false | 设置当前节点下的子节点是否需要联动拖动 |
filterOverlap | boolean | false | 控制节点在设置 overlap 为 true 时是否仍允许被覆盖 |
返回topology组件的实例,可通过实例调用组件内部的方法:
移动到中心,当所有节点都有位置数据(positions)时,移动的中心点为内容的中心,否则为画布的中心。
自动计算布局
renderTreeNode的第二个参数,包含以下装饰器函数:
anchorDecorator是一个高阶函数,经过 anchorDecorator 包装的控件将变成一个锚点。
anchorDecorator(options)(ReactNode)
name | type | default | description |
---|---|---|---|
anchorId | string | - | 锚点唯一id,如果不传将默认生成一个自增的id |
模板装饰器,用于包装模板组件
disabled 字段控制 TemplateNode 是否启用
<TemplateWrapper disabled generator={this.generatorNodeData}>
<div>模板节点</div>
</TemplateWrapper>
name | type | default | description |
---|---|---|---|
data | () => nodeData | - | 数据生成器,用于产生节点数据 |
FAQs
We found that @byai/topology demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.