ngraph.svg 0.0.15 → 0.1.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Andrei Kashcha
3
+ Copyright (c) 2014-2025 Andrei Kashcha
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -10,6 +10,45 @@ With [npm](https://npmjs.org) do:
10
10
  npm install ngraph.svg
11
11
  ```
12
12
 
13
+ # dev/build
14
+
15
+ This repo now uses native ES modules and Vite for development and library build:
16
+
17
+ - Start examples: `npm run dev` (opens `/example/basic/index.html`).
18
+ - Build library: `npm run build`.
19
+ - Preview build: `npm run preview`.
20
+
21
+ Basic ESM usage:
22
+
23
+ ```js
24
+ import createGraph from 'ngraph.graph';
25
+ import createRenderer from 'ngraph.svg';
26
+
27
+ const graph = createGraph();
28
+ graph.addLink('a', 'b');
29
+
30
+ const renderer = createRenderer(graph);
31
+ renderer.run();
32
+ ```
33
+
34
+ ## Standalone browser build
35
+
36
+ If you prefer a single script without bundlers, build the standalone bundle and include it directly in the browser. It exposes a global `ngraphSvg`.
37
+
38
+ ```html
39
+ <!-- After running: npm run build:standalone -->
40
+ <script src="./dist/ngraph.svg.standalone.js"></script>
41
+ <script type="module">
42
+ import createGraph from 'https://unpkg.com/ngraph.graph@20?module';
43
+ const graph = createGraph();
44
+ graph.addLink('a', 'b');
45
+ const renderer = ngraphSvg(graph);
46
+ renderer.run();
47
+ <\/script>
48
+ ```
49
+
50
+ Note: The standalone build bundles this library's dependencies, but you still need to provide a graph instance (e.g. from `ngraph.graph`).
51
+
13
52
  # license
14
53
 
15
54
  MIT