power-link 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,8 +7,8 @@ A pure TypeScript visual node connector for creating draggable connections betwe
7
7
 
8
8
  ![Node Link Connector Demo](https://github.com/Tem-man/power-link/blob/main/public/images/screen-shot.png)
9
9
 
10
-
11
- ### [online demo](https://tem-man.github.io/power-link)
10
+ ### online demo
11
+ visit [online demo](https://tem-man.github.io/power-link)
12
12
 
13
13
  ## ✨ Features
14
14
 
package/dist/index.d.mts CHANGED
@@ -23,6 +23,8 @@ interface Dot {
23
23
  /** 节点对象 */
24
24
  interface ConnectorNode {
25
25
  id: string;
26
+ /** 节点名称 */
27
+ label?: string;
26
28
  element: HTMLElement;
27
29
  info?: Record<string, unknown>;
28
30
  dots: Partial<Record<DotPosition, Dot>>;
@@ -104,6 +106,8 @@ interface ConnectorOptions extends Partial<ConnectorConfig> {
104
106
  }
105
107
  /** 节点注册选项 */
106
108
  interface RegisterNodeOptions {
109
+ /** 节点名称 */
110
+ label?: string;
107
111
  info?: Record<string, unknown>;
108
112
  dotPositions?: 'both' | DotPosition | DotPosition[];
109
113
  }
@@ -114,6 +118,8 @@ interface SilentOptions {
114
118
  /** 导出的单个节点数据 */
115
119
  interface ExportNodeData {
116
120
  id: string;
121
+ /** 节点名称 */
122
+ label?: string;
117
123
  x: number;
118
124
  y: number;
119
125
  info?: Record<string, unknown>;
@@ -122,7 +128,15 @@ interface ExportNodeData {
122
128
  /** 导出的单条连接数据 */
123
129
  interface ExportConnectionData {
124
130
  from: string;
131
+ /** from 节点名称 */
132
+ fromLabel?: string;
133
+ /** from 节点附加信息 */
134
+ fromInfo?: Record<string, unknown>;
125
135
  to: string;
136
+ /** to 节点名称 */
137
+ toLabel?: string;
138
+ /** to 节点附加信息 */
139
+ toInfo?: Record<string, unknown>;
126
140
  fromDot: DotPosition;
127
141
  toDot: DotPosition;
128
142
  }
package/dist/index.d.ts CHANGED
@@ -23,6 +23,8 @@ interface Dot {
23
23
  /** 节点对象 */
24
24
  interface ConnectorNode {
25
25
  id: string;
26
+ /** 节点名称 */
27
+ label?: string;
26
28
  element: HTMLElement;
27
29
  info?: Record<string, unknown>;
28
30
  dots: Partial<Record<DotPosition, Dot>>;
@@ -104,6 +106,8 @@ interface ConnectorOptions extends Partial<ConnectorConfig> {
104
106
  }
105
107
  /** 节点注册选项 */
106
108
  interface RegisterNodeOptions {
109
+ /** 节点名称 */
110
+ label?: string;
107
111
  info?: Record<string, unknown>;
108
112
  dotPositions?: 'both' | DotPosition | DotPosition[];
109
113
  }
@@ -114,6 +118,8 @@ interface SilentOptions {
114
118
  /** 导出的单个节点数据 */
115
119
  interface ExportNodeData {
116
120
  id: string;
121
+ /** 节点名称 */
122
+ label?: string;
117
123
  x: number;
118
124
  y: number;
119
125
  info?: Record<string, unknown>;
@@ -122,7 +128,15 @@ interface ExportNodeData {
122
128
  /** 导出的单条连接数据 */
123
129
  interface ExportConnectionData {
124
130
  from: string;
131
+ /** from 节点名称 */
132
+ fromLabel?: string;
133
+ /** from 节点附加信息 */
134
+ fromInfo?: Record<string, unknown>;
125
135
  to: string;
136
+ /** to 节点名称 */
137
+ toLabel?: string;
138
+ /** to 节点附加信息 */
139
+ toInfo?: Record<string, unknown>;
126
140
  fromDot: DotPosition;
127
141
  toDot: DotPosition;
128
142
  }
@@ -445,6 +445,7 @@ var PowerLink = (function (exports) {
445
445
  const y = parseFloat(element.style.top) || 0;
446
446
  const node = {
447
447
  id,
448
+ label: options.label,
448
449
  element,
449
450
  info: options.info,
450
451
  dots,
@@ -1362,6 +1363,7 @@ var PowerLink = (function (exports) {
1362
1363
  return {
1363
1364
  nodes: this.ctx.nodes.map((node) => ({
1364
1365
  id: node.id,
1366
+ label: node.label,
1365
1367
  x: node.x,
1366
1368
  y: node.y,
1367
1369
  info: node.info,
@@ -1369,7 +1371,11 @@ var PowerLink = (function (exports) {
1369
1371
  })),
1370
1372
  connections: this.ctx.connections.map((conn) => ({
1371
1373
  from: conn.fromNode.id,
1374
+ fromLabel: conn.fromNode.label,
1375
+ fromInfo: conn.fromNode.info,
1372
1376
  to: conn.toNode.id,
1377
+ toLabel: conn.toNode.label,
1378
+ toInfo: conn.toNode.info,
1373
1379
  fromDot: conn.fromDot.position,
1374
1380
  toDot: conn.toDot.position
1375
1381
  })),
package/dist/index.js CHANGED
@@ -446,6 +446,7 @@ var _NodeManager = class _NodeManager {
446
446
  const y = parseFloat(element.style.top) || 0;
447
447
  const node = {
448
448
  id,
449
+ label: options.label,
449
450
  element,
450
451
  info: options.info,
451
452
  dots,
@@ -1363,6 +1364,7 @@ var _Connector = class _Connector {
1363
1364
  return {
1364
1365
  nodes: this.ctx.nodes.map((node) => ({
1365
1366
  id: node.id,
1367
+ label: node.label,
1366
1368
  x: node.x,
1367
1369
  y: node.y,
1368
1370
  info: node.info,
@@ -1370,7 +1372,11 @@ var _Connector = class _Connector {
1370
1372
  })),
1371
1373
  connections: this.ctx.connections.map((conn) => ({
1372
1374
  from: conn.fromNode.id,
1375
+ fromLabel: conn.fromNode.label,
1376
+ fromInfo: conn.fromNode.info,
1373
1377
  to: conn.toNode.id,
1378
+ toLabel: conn.toNode.label,
1379
+ toInfo: conn.toNode.info,
1374
1380
  fromDot: conn.fromDot.position,
1375
1381
  toDot: conn.toDot.position
1376
1382
  })),
package/dist/index.mjs CHANGED
@@ -442,6 +442,7 @@ var _NodeManager = class _NodeManager {
442
442
  const y = parseFloat(element.style.top) || 0;
443
443
  const node = {
444
444
  id,
445
+ label: options.label,
445
446
  element,
446
447
  info: options.info,
447
448
  dots,
@@ -1359,6 +1360,7 @@ var _Connector = class _Connector {
1359
1360
  return {
1360
1361
  nodes: this.ctx.nodes.map((node) => ({
1361
1362
  id: node.id,
1363
+ label: node.label,
1362
1364
  x: node.x,
1363
1365
  y: node.y,
1364
1366
  info: node.info,
@@ -1366,7 +1368,11 @@ var _Connector = class _Connector {
1366
1368
  })),
1367
1369
  connections: this.ctx.connections.map((conn) => ({
1368
1370
  from: conn.fromNode.id,
1371
+ fromLabel: conn.fromNode.label,
1372
+ fromInfo: conn.fromNode.info,
1369
1373
  to: conn.toNode.id,
1374
+ toLabel: conn.toNode.label,
1375
+ toInfo: conn.toNode.info,
1370
1376
  fromDot: conn.fromDot.position,
1371
1377
  toDot: conn.toDot.position
1372
1378
  })),
package/package.json CHANGED
@@ -1,10 +1,21 @@
1
1
  {
2
2
  "name": "power-link",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A pure TypeScript visual node connector for creating draggable connections between nodes. Framework-agnostic and easy to use",
5
- "author": "Lin Jiman <temman_lin@qq.com>",
5
+ "author": {
6
+ "name": "Lin Ji Man",
7
+ "email": "Temman_lin@qq.com"
8
+ },
9
+ "keywords": [
10
+ "power-link",
11
+ "connector",
12
+ "node-link",
13
+ "visual-connector",
14
+ "drag-line",
15
+ "bezier-curve"
16
+ ],
6
17
  "license": "MIT",
7
- "homepage": "https://github.com/Tem-man/power-link",
18
+ "homepage": "https://tem-man.github.io/power-link",
8
19
  "repository": {
9
20
  "type": "git",
10
21
  "url": "git+https://github.com/Tem-man/power-link.git"