@@ -2,12 +2,62 @@ import { json, alg, type Path } from "@dagrejs/graphlib";
2
2
3
3
type D = { [ node : string ] : Path } ;
4
4
5
+ // const vizdomCss = [
6
+ // `@keyframes dash {
7
+ // from {
8
+ // stroke-dashoffset: 40;
9
+ // }
10
+ // to {
11
+ // stroke-dashoffset: 0;
12
+ // }
13
+ // }`,
14
+ // `.edge.active a path:first-child {
15
+ // stroke-dasharray: 5 5;
16
+ // animation-name: dash;
17
+ // animation-duration: 1000ms;
18
+ // stroke-dashoffset: 0;
19
+ // animation-iteration-count: infinite;
20
+ // animation-timing-function: linear;
21
+ // }`,
22
+
23
+ // `.node.selected a *:first-child {
24
+ // stroke-width: 2px;
25
+ // }`,
26
+ // `.node {
27
+ // cursor: pointer;
28
+ // }`,
29
+ // `@media (prefers-reduced-motion) {
30
+ // .edge.active a path:first-child {
31
+ // animation-duration: 4000ms;
32
+ // }
33
+ // }`,
34
+ // ];
35
+
5
36
// interactivity for vizdom diagrams
6
- document . querySelectorAll ( ".vizdom.ants" ) . forEach ( ( container ) => {
37
+ document . querySelectorAll ( ".vizdom.ants" ) . forEach ( async ( container ) => {
7
38
const data = container . getAttribute ( "data-beoe" )
8
39
? JSON . parse ( container . getAttribute ( "data-beoe" ) ! )
9
40
: null ;
10
41
42
+ // const iframe = container.querySelector("iframe");
43
+ // if (iframe) {
44
+ // if (!iframe.contentDocument)
45
+ // await new Promise((resolve) =>
46
+ // iframe.addEventListener("load", () => resolve(0))
47
+ // );
48
+
49
+ // container = iframe.contentDocument!.querySelector("svg")! as Element;
50
+ // // container.setAttribute("preserveAspectRatio", "xMinYMin meet");
51
+ // const style = iframe.contentDocument!.createElement("style");
52
+ // style.setAttribute("type", "text/css");
53
+ // container.prepend(style);
54
+ // const styleSheet = iframe.contentDocument!.styleSheets[0];
55
+ // if (styleSheet)
56
+ // vizdomCss.forEach((row) =>
57
+ // styleSheet.insertRule(row, styleSheet.cssRules.length)
58
+ // );
59
+ // }
60
+
11
61
if ( ! data ) return ;
12
62
const graph = json . read ( data ) ;
13
63
@@ -129,11 +179,21 @@ document.querySelectorAll(".vizdom.ants").forEach((container) => {
129
179
} ) ;
130
180
131
181
// interactivity for vizdom diagrams
132
- document . querySelectorAll ( ".vizdom.shadow" ) . forEach ( ( container ) => {
182
+ document . querySelectorAll ( ".vizdom.shadow" ) . forEach ( async ( container ) => {
133
183
const data = container . getAttribute ( "data-beoe" )
134
184
? JSON . parse ( container . getAttribute ( "data-beoe" ) ! )
135
185
: null ;
136
186
187
+ // const iframe = container.querySelector("iframe");
188
+ // if (iframe) {
189
+ // if (!iframe.contentDocument)
190
+ // await new Promise((resolve) =>
191
+ // iframe.addEventListener("load", () => resolve(0))
192
+ // );
193
+
194
+ // container = iframe.contentDocument!.querySelector("svg")! as Element;
195
+ // }
196
+
137
197
if ( ! data ) return ;
138
198
const graph = json . read ( data ) ;
139
199
0 commit comments