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 +1 -1
- package/README.md +39 -0
- package/example/basic/bundle.js +4287 -3709
- package/example/basic/index.html +1 -1
- package/example/basic/index.js +5 -2
- package/example/customNode/bundle.js +4288 -3710
- package/example/customNode/index.html +1 -1
- package/example/customNode/index.js +6 -4
- package/example/customSpringLength/bundle.js +4287 -3709
- package/example/customSpringLength/index.html +1 -1
- package/example/customSpringLength/index.js +4 -2
- package/index.js +86 -73
- package/lib/defaultLayout.js +6 -9
- package/lib/defaultUI.js +2 -5
- package/package.json +23 -9
- package/vite.config.js +34 -0
- package/vite.standalone.config.js +16 -0
- package/.npmignore +0 -15
package/LICENSE
CHANGED
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
|