power-link 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. package/README.md +39 -86
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # node-link-utils
1
+ # power-link
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/node-link-utils.svg)](https://www.npmjs.com/package/node-link-utils)
4
4
  [![license](https://img.shields.io/npm/l/node-link-utils.svg)](https://github.com/your-username/node-link-utils/blob/main/LICENSE)
@@ -14,7 +14,7 @@ A pure JavaScript visual node connector for creating draggable connections betwe
14
14
  Your browser does not support the video tag.
15
15
  </video>
16
16
 
17
- **Watch the demo video** to see node-link-utils in action! [Download video](https://github.com/Tem-man/node-link-utils/raw/main/packages/images/video.mp4)
17
+ **Watch the demo video** to see power-link in action! [Download video](https://github.com/Tem-man/node-link-utils/raw/main/packages/images/video.mp4)
18
18
 
19
19
  ## ✨ Features
20
20
 
@@ -31,19 +31,19 @@ A pure JavaScript visual node connector for creating draggable connections betwe
31
31
  ## 📦 Installation
32
32
 
33
33
  ```bash
34
- npm install node-link-utils
34
+ npm install power-link
35
35
  ```
36
36
 
37
37
  Or using yarn:
38
38
 
39
39
  ```bash
40
- yarn add node-link-utils
40
+ yarn add power-link
41
41
  ```
42
42
 
43
43
  Or using pnpm:
44
44
 
45
45
  ```bash
46
- pnpm add node-link-utils
46
+ pnpm add power-link
47
47
  ```
48
48
 
49
49
  ## 🚀 Quick Start
@@ -51,7 +51,7 @@ pnpm add node-link-utils
51
51
  ### Basic Usage
52
52
 
53
53
  ```javascript
54
- import Connector from "node-link-utils";
54
+ import Connector from "power-link";
55
55
 
56
56
  // 1. Get container element
57
57
  const container = document.getElementById("connector-container");
@@ -74,7 +74,7 @@ const connector = new Connector({
74
74
 
75
75
  onDisconnect: (connection) => {
76
76
  console.log("Connection removed:", connection);
77
- }
77
+ },
78
78
  });
79
79
 
80
80
  // 3. Register nodes
@@ -82,33 +82,20 @@ const node1 = document.getElementById("node1");
82
82
  const node2 = document.getElementById("node2");
83
83
 
84
84
  connector.registerNode("node1", node1, {
85
- dotPositions: ["right"] // Only right connection dot
85
+ dotPositions: ["right"], // Only right connection dot
86
86
  });
87
87
 
88
88
  connector.registerNode("node2", node2, {
89
- dotPositions: ["left", "right"] // Both left and right dots
89
+ dotPositions: ["left", "right"], // Both left and right dots
90
90
  });
91
91
  ```
92
92
 
93
93
  ### HTML Structure
94
94
 
95
95
  ```html
96
- <div
97
- id="connector-container"
98
- style="position: relative; height: 600px;"
99
- >
100
- <div
101
- id="node1"
102
- style="position: absolute; left: 100px; top: 100px;"
103
- >
104
- Node 1
105
- </div>
106
- <div
107
- id="node2"
108
- style="position: absolute; left: 400px; top: 100px;"
109
- >
110
- Node 2
111
- </div>
96
+ <div id="connector-container" style="position: relative; height: 600px;">
97
+ <div id="node1" style="position: absolute; left: 100px; top: 100px;">Node 1</div>
98
+ <div id="node2" style="position: absolute; left: 400px; top: 100px;">Node 2</div>
112
99
  </div>
113
100
  ```
114
101
 
@@ -153,7 +140,7 @@ Register a node for connection.
153
140
 
154
141
  ```javascript
155
142
  connector.registerNode("myNode", element, {
156
- dotPositions: ["right"]
143
+ dotPositions: ["right"],
157
144
  });
158
145
  ```
159
146
 
@@ -240,28 +227,15 @@ connector.destroy();
240
227
 
241
228
  ```vue
242
229
  <template>
243
- <div
244
- class="container"
245
- ref="containerRef"
246
- >
247
- <div
248
- class="node"
249
- ref="node1Ref"
250
- >
251
- Node 1
252
- </div>
253
- <div
254
- class="node"
255
- ref="node2Ref"
256
- >
257
- Node 2
258
- </div>
230
+ <div class="container" ref="containerRef">
231
+ <div class="node" ref="node1Ref">Node 1</div>
232
+ <div class="node" ref="node2Ref">Node 2</div>
259
233
  </div>
260
234
  </template>
261
235
 
262
236
  <script setup>
263
237
  import { ref, onMounted, onBeforeUnmount } from "vue";
264
- import Connector from "node-link-utils";
238
+ import Connector from "power-link";
265
239
 
266
240
  const containerRef = ref(null);
267
241
  const node1Ref = ref(null);
@@ -277,15 +251,15 @@ connector.destroy();
277
251
  },
278
252
  onDisconnect: (connection) => {
279
253
  console.log("Connection removed:", connection);
280
- }
254
+ },
281
255
  });
282
256
 
283
257
  connector.registerNode("node1", node1Ref.value, {
284
- dotPositions: ["right"]
258
+ dotPositions: ["right"],
285
259
  });
286
260
 
287
261
  connector.registerNode("node2", node2Ref.value, {
288
- dotPositions: ["left"]
262
+ dotPositions: ["left"],
289
263
  });
290
264
  });
291
265
 
@@ -318,7 +292,7 @@ connector.destroy();
318
292
 
319
293
  ```jsx
320
294
  import { useEffect, useRef } from "react";
321
- import Connector from "node-link-utils";
295
+ import Connector from "power-link";
322
296
 
323
297
  function App() {
324
298
  const containerRef = useRef(null);
@@ -336,15 +310,15 @@ function App() {
336
310
  },
337
311
  onDisconnect: (connection) => {
338
312
  console.log("Connection removed:", connection);
339
- }
313
+ },
340
314
  });
341
315
 
342
316
  connectorRef.current.registerNode("node1", node1Ref.current, {
343
- dotPositions: ["right"]
317
+ dotPositions: ["right"],
344
318
  });
345
319
 
346
320
  connectorRef.current.registerNode("node2", node2Ref.current, {
347
- dotPositions: ["left"]
321
+ dotPositions: ["left"],
348
322
  });
349
323
 
350
324
  return () => {
@@ -355,20 +329,11 @@ function App() {
355
329
  }, []);
356
330
 
357
331
  return (
358
- <div
359
- ref={containerRef}
360
- style={{ position: "relative", height: "600px" }}
361
- >
362
- <div
363
- ref={node1Ref}
364
- style={{ position: "absolute", left: "100px", top: "100px" }}
365
- >
332
+ <div ref={containerRef} style={{ position: "relative", height: "600px" }}>
333
+ <div ref={node1Ref} style={{ position: "absolute", left: "100px", top: "100px" }}>
366
334
  Node 1
367
335
  </div>
368
- <div
369
- ref={node2Ref}
370
- style={{ position: "absolute", left: "400px", top: "100px" }}
371
- >
336
+ <div ref={node2Ref} style={{ position: "absolute", left: "400px", top: "100px" }}>
372
337
  Node 2
373
338
  </div>
374
339
  </div>
@@ -400,38 +365,26 @@ function App() {
400
365
  </head>
401
366
  <body>
402
367
  <div id="container">
403
- <div
404
- id="node1"
405
- class="node"
406
- style="left: 100px; top: 100px;"
407
- >
408
- Node 1
409
- </div>
410
- <div
411
- id="node2"
412
- class="node"
413
- style="left: 400px; top: 100px;"
414
- >
415
- Node 2
416
- </div>
368
+ <div id="node1" class="node" style="left: 100px; top: 100px;">Node 1</div>
369
+ <div id="node2" class="node" style="left: 400px; top: 100px;">Node 2</div>
417
370
  </div>
418
371
 
419
372
  <script type="module">
420
- import Connector from "node-link-utils";
373
+ import Connector from "power-link";
421
374
 
422
375
  const connector = new Connector({
423
376
  container: document.getElementById("container"),
424
377
  onConnect: (connection) => {
425
378
  console.log("Connection created:", connection);
426
- }
379
+ },
427
380
  });
428
381
 
429
382
  connector.registerNode("node1", document.getElementById("node1"), {
430
- dotPositions: ["right"]
383
+ dotPositions: ["right"],
431
384
  });
432
385
 
433
386
  connector.registerNode("node2", document.getElementById("node2"), {
434
- dotPositions: ["left"]
387
+ dotPositions: ["left"],
435
388
  });
436
389
  </script>
437
390
  </body>
@@ -445,17 +398,17 @@ function App() {
445
398
  ```javascript
446
399
  // Node with both left and right connection points
447
400
  connector.registerNode("centerNode", element, {
448
- dotPositions: ["left", "right"]
401
+ dotPositions: ["left", "right"],
449
402
  });
450
403
 
451
404
  // Node with only left connection point
452
405
  connector.registerNode("endNode", element, {
453
- dotPositions: ["left"]
406
+ dotPositions: ["left"],
454
407
  });
455
408
 
456
409
  // Node with only right connection point
457
410
  connector.registerNode("startNode", element, {
458
- dotPositions: ["right"]
411
+ dotPositions: ["right"],
459
412
  });
460
413
  ```
461
414
 
@@ -468,7 +421,7 @@ const connector = new Connector({
468
421
  lineWidth: 3, // Thicker lines
469
422
  dotSize: 16, // Larger dots
470
423
  dotColor: "#4ECDC4", // Teal dots
471
- deleteButtonSize: 24 // Larger delete button
424
+ deleteButtonSize: 24, // Larger delete button
472
425
  });
473
426
  ```
474
427
 
@@ -491,7 +444,7 @@ const connector = new Connector({
491
444
 
492
445
  // Update database, state, etc.
493
446
  removeConnection(connection);
494
- }
447
+ },
495
448
  });
496
449
  ```
497
450
 
@@ -520,4 +473,4 @@ Give a ⭐️ if this project helped you!
520
473
 
521
474
  ---
522
475
 
523
- Made with ❤️ by the node-link-utils team
476
+ Made with ❤️ by the power-link team
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-link",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "A pure JavaScript visual node connector for creating draggable connections between nodes. Framework-agnostic and easy to use",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,6 +19,7 @@
19
19
  "access": "public"
20
20
  },
21
21
  "keywords": [
22
+ "power-link",
22
23
  "connector",
23
24
  "node-link",
24
25
  "visual-connector",