-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
default_esm.html
50 lines (49 loc) · 1.26 KB
/
default_esm.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!doctype html>
<html>
<head>
<title>ESM Sample</title>
<style>
#app {
width: 600px;
height: 400px;
display: block;
}
</style>
</head>
<body>
<div id="app"></div>
<script defer src="https://cdn.jsdelivr.net/npm/es-module-shims"></script>
<script type="importmap-shim">
{
"imports": {
"cytoscape": "https://cdn.jsdelivr.net/npm/[email protected]/dist/cytoscape.esm.min.js",
"cytoscape-layers": "https://cdn.jsdelivr.net/npm/cytoscape-layers/dist/cytoscapelayers.esm.js",
"cytoscape-bubblesets": "../build/index.esm.js"
}
}
</script>
<script type="module-shim">
import cytoscape from 'cytoscape';
import BubbleSets from 'cytoscape-bubblesets';
cytoscape.use(BubbleSets);
const cy = cytoscape({
container: document.getElementById('app'),
elements: [
{ data: { id: 'a' } },
{ data: { id: 'b' } },
{
data: {
id: 'ab',
source: 'a',
target: 'b',
},
},
],
});
cy.ready(() => {
const bb = cy.bubbleSets();
bb.addPath(cy.nodes(), cy.edges(), null);
});
</script>
</body>
</html>