Skip to content

Commit 99c01c3

Browse files
DoodleBUGS: Code Generation, Data Input, Advanced Exports, and State Persistence (#347)
Advanced Export Functionality: - Added a `svg` and `jpg` exports. - Added a ExportModal component that allows for customization of all image exports (background, scale, quality, etc.). - All export options (PNG, JPG, SVG, JSON) are now under a single "Export" dropdown in navbar. State Persistence: - The application now remembers and restores the user's session on page reload, including the last active project, the last opened graph, custom sidebar widths, active tab in right sidebar. - Sidebars are now resizable, with their widths persisted in localStorage. Advanced Code Editor: - Upgraded the JSON editor and BUGS code preview panel to use CodeMirror with syntax highlighting, line numbers, and better scrolling. - fields (like id) are now marked as read-only within the editor, so user won't be able to edit it. BUGS Code Generation: - A new `useBugsCodeGenerator` composable now generates BUGS model code from the graph structure (Not the correct code but it's recognizing nodes and edges properly, still need too much work and fixes). - Implemented a topological sort to ensure correct dependency order. Centralized Configuration: Refactored the app to use a central `nodeDefinitions.ts` file as the single source of truth for all node types and properties. Bug Fixes: - Fixed a bug that caused `png` export to generate corrupted files. - Fixed the right-click context menu `Remove` to correctly update the application state. - Plates are now automatically deleted when they become empty. TODO before merging this PR: - [ ] Implement two-way highlighting: selecting an element on the canvas should scrolls to and highlight the corresponding object in the JSON editor. (I have tried to implement this but facing some issues) - [x] Data Input Panel: It's not static now but still does not work properly! - [x] By default, name new nodes as greek alphabets in sequence! --------- Co-authored-by: Jash Ambaliya <[email protected]>
1 parent 648f903 commit 99c01c3

34 files changed

+2597
-725
lines changed

DoodleBUGS/.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* text=auto eol=lf
1+
* text=auto
2+
*.ts text eol=lf

DoodleBUGS/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dist
1414
dist-ssr
1515
coverage
1616
*.local
17+
ztest
1718

1819
/cypress/videos/
1920
/cypress/screenshots/

DoodleBUGS/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ A web-based graphical editor for creating Bayesian models, inspired by DoodleBUG
66

77
This project is currently in the pre-alpha phase of development as part of the Google Summer of Code 2025 program.
88

9+
> Please avoid using this project in WebKit browsers like Safari, as it may not function correctly. We recommend using Chromium-based browsers such as Google Chrome or Microsoft Edge for the best experience, It works fine in Firefox as well. And it does not work in any browser in ipadOS and iOS as all browsers in these platforms are WebKit based.
10+
911
- Contributor: [Shravan Goswami @shravanngoswamii](https://github.com/shravanngoswamii)
1012
- Mentor: [Xianda Sun @sunxd3](https://github.com/sunxd3)
1113

DoodleBUGS/package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DoodleBUGS/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@types/cytoscape": "^3.21.9",
16+
"codemirror": "^5.65.19",
1617
"cytoscape": "^3.32.0",
1718
"cytoscape-compound-drag-and-drop": "^1.1.0",
1819
"cytoscape-context-menus": "^4.2.1",
@@ -22,11 +23,13 @@
2223
"cytoscape-no-overlap": "^1.0.1",
2324
"cytoscape-panzoom": "^2.5.3",
2425
"cytoscape-snap-to-grid": "^2.0.0",
26+
"cytoscape-svg": "^0.4.0",
2527
"pinia": "^3.0.2",
2628
"vue": "^3.5.13"
2729
},
2830
"devDependencies": {
2931
"@tsconfig/node22": "^22.0.1",
32+
"@types/codemirror": "^5.60.16",
3033
"@types/cytoscape-context-menus": "^4.1.4",
3134
"@types/node": "^22.14.0",
3235
"@vitejs/plugin-vue": "^5.2.3",
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
{
2+
"data": {
3+
"N": 30,
4+
"T": 5,
5+
"x": [
6+
8.0,
7+
15.0,
8+
22.0,
9+
29.0,
10+
36.0
11+
],
12+
"xbar": 22,
13+
"Y": [
14+
[
15+
151,
16+
199,
17+
246,
18+
283,
19+
320
20+
],
21+
[
22+
145,
23+
199,
24+
249,
25+
293,
26+
354
27+
],
28+
[
29+
147,
30+
214,
31+
263,
32+
312,
33+
328
34+
],
35+
[
36+
155,
37+
200,
38+
237,
39+
272,
40+
297
41+
],
42+
[
43+
135,
44+
188,
45+
230,
46+
280,
47+
323
48+
],
49+
[
50+
159,
51+
210,
52+
252,
53+
298,
54+
331
55+
],
56+
[
57+
141,
58+
189,
59+
231,
60+
275,
61+
305
62+
],
63+
[
64+
159,
65+
201,
66+
248,
67+
297,
68+
338
69+
],
70+
[
71+
177,
72+
220,
73+
260,
74+
309,
75+
331
76+
],
77+
[
78+
134,
79+
182,
80+
220,
81+
260,
82+
295
83+
],
84+
[
85+
160,
86+
208,
87+
261,
88+
313,
89+
352
90+
],
91+
[
92+
143,
93+
188,
94+
220,
95+
273,
96+
314
97+
],
98+
[
99+
154,
100+
200,
101+
244,
102+
289,
103+
325
104+
],
105+
[
106+
161,
107+
218,
108+
266,
109+
304,
110+
340
111+
],
112+
[
113+
142,
114+
184,
115+
223,
116+
262,
117+
298
118+
],
119+
[
120+
156,
121+
203,
122+
243,
123+
283,
124+
317
125+
],
126+
[
127+
157,
128+
212,
129+
259,
130+
307,
131+
336
132+
],
133+
[
134+
152,
135+
203,
136+
245,
137+
286,
138+
324
139+
],
140+
[
141+
154,
142+
205,
143+
253,
144+
298,
145+
334
146+
],
147+
[
148+
139,
149+
190,
150+
225,
151+
267,
152+
302
153+
],
154+
[
155+
146,
156+
196,
157+
247,
158+
289,
159+
321
160+
],
161+
[
162+
161,
163+
215,
164+
254,
165+
293,
166+
332
167+
],
168+
[
169+
153,
170+
207,
171+
256,
172+
303,
173+
345
174+
],
175+
[
176+
149,
177+
198,
178+
245,
179+
287,
180+
324
181+
],
182+
[
183+
144,
184+
192,
185+
242,
186+
289,
187+
326
188+
],
189+
[
190+
162,
191+
211,
192+
262,
193+
315,
194+
357
195+
],
196+
[
197+
157,
198+
202,
199+
242,
200+
281,
201+
316
202+
],
203+
[
204+
150,
205+
204,
206+
256,
207+
298,
208+
335
209+
],
210+
[
211+
151,
212+
202,
213+
248,
214+
290,
215+
325
216+
],
217+
[
218+
163,
219+
216,
220+
265,
221+
307,
222+
342
223+
]
224+
]
225+
},
226+
"inits": {}
227+
}

0 commit comments

Comments
 (0)