pyegeria 5.3.4.4.dev5__py3-none-any.whl → 5.3.4.4.dev7__py3-none-any.whl
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.
- pyegeria/mermaid_utilities.py +92 -66
- {pyegeria-5.3.4.4.dev5.dist-info → pyegeria-5.3.4.4.dev7.dist-info}/METADATA +1 -1
- {pyegeria-5.3.4.4.dev5.dist-info → pyegeria-5.3.4.4.dev7.dist-info}/RECORD +6 -6
- {pyegeria-5.3.4.4.dev5.dist-info → pyegeria-5.3.4.4.dev7.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.4.4.dev5.dist-info → pyegeria-5.3.4.4.dev7.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.4.4.dev5.dist-info → pyegeria-5.3.4.4.dev7.dist-info}/entry_points.txt +0 -0
pyegeria/mermaid_utilities.py
CHANGED
@@ -232,6 +232,7 @@ def construct_mermaid_html(mermaid_str: str) -> str:
|
|
232
232
|
title_label, guid, mermaid_code = parse_mermaid_code(mermaid_str)
|
233
233
|
|
234
234
|
graph_id = title_label.replace(" ", "_")
|
235
|
+
|
235
236
|
# Construct the HTML content with Mermaid.js initialization and zoom/pan support
|
236
237
|
mermaid_html = f"""
|
237
238
|
<!DOCTYPE html>
|
@@ -239,118 +240,143 @@ def construct_mermaid_html(mermaid_str: str) -> str:
|
|
239
240
|
<head>
|
240
241
|
<meta charset="UTF-8">
|
241
242
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
242
|
-
<title>
|
243
|
-
|
243
|
+
<title>Mermaid Diagram</title>
|
244
|
+
<!-- Load Mermaid.js -->
|
245
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"></script>
|
246
|
+
<style>
|
247
|
+
body {{
|
248
|
+
font-family: Arial, sans-serif;
|
249
|
+
margin: 0;
|
250
|
+
padding: 0;
|
251
|
+
background-color: #f4f4f4;
|
252
|
+
}}
|
253
|
+
.diagram-container {{
|
254
|
+
display: flex;
|
255
|
+
flex-direction: column;
|
256
|
+
align-items: center;
|
257
|
+
padding: 20px;
|
258
|
+
background-color: white;
|
259
|
+
border: 1px solid #ddd;
|
260
|
+
border-radius: 8px;
|
261
|
+
margin: 20px;
|
262
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
263
|
+
max-width: 800px;
|
264
|
+
margin: 30px auto;
|
265
|
+
}}
|
266
|
+
.diagram-header {{
|
267
|
+
margin-bottom: 20px;
|
268
|
+
font-size: 1.8em;
|
269
|
+
font-weight: bold;
|
270
|
+
color: #007acc;
|
271
|
+
text-align: center;
|
272
|
+
}}
|
273
|
+
.pan-zoom-container {{
|
274
|
+
position: relative;
|
275
|
+
width: 100%;
|
276
|
+
height: 500px;
|
277
|
+
overflow: hidden;
|
278
|
+
background-color: #f9f9f9;
|
279
|
+
}}
|
280
|
+
.pan-zoom-content {{
|
281
|
+
position: absolute;
|
282
|
+
transform-origin: 0 0;
|
283
|
+
cursor: grab;
|
284
|
+
}}
|
285
|
+
.pan-zoom-content:active {{
|
286
|
+
cursor: grabbing;
|
287
|
+
}}
|
288
|
+
</style>
|
289
|
+
</head>
|
290
|
+
<body>
|
291
|
+
<div class="diagram-header">
|
292
|
+
<h3 class='diagram-header'>{title_label}</h3>
|
293
|
+
{guid}
|
294
|
+
</div>
|
295
|
+
<!-- Diagram with Header -->
|
296
|
+
<div class="diagram-container">
|
297
|
+
|
298
|
+
<div class="pan-zoom-container">
|
299
|
+
<div id="{graph_id}" class="mermaid pan-zoom-content">{mermaid_code}</div>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
|
244
303
|
<script>
|
245
|
-
// Initialize Mermaid.js
|
304
|
+
// Initialize Mermaid.js and enable pan/zoom
|
246
305
|
document.addEventListener("DOMContentLoaded", function() {{
|
247
306
|
const graphContainer = document.getElementById("{graph_id}");
|
248
|
-
|
249
|
-
// Inject Mermaid code into the container
|
250
|
-
graphContainer.innerHTML = `{mermaid_code}`;
|
251
|
-
|
252
|
-
// Manually render the Mermaid graph
|
253
|
-
window.mermaid?.run({{ querySelector: "#{graph_id}" }});
|
254
|
-
}});
|
255
307
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
const content = document.querySelector('.pan-zoom-content');
|
308
|
+
// Render the Mermaid diagram
|
309
|
+
mermaid.initialize({{ startOnLoad: true }});
|
310
|
+
mermaid.init(undefined, graphContainer);
|
260
311
|
|
261
|
-
|
262
|
-
|
263
|
-
|
312
|
+
// Enable pan/zoom functionality
|
313
|
+
const container = document.querySelector(".pan-zoom-container");
|
314
|
+
const content = document.querySelector(".pan-zoom-content");
|
315
|
+
|
316
|
+
let scale = 1; // Zoom level
|
317
|
+
let panX = 0; // X-axis pan
|
318
|
+
let panY = 0; // Y-axis pan
|
264
319
|
let isDragging = false;
|
265
320
|
let startX, startY;
|
266
321
|
|
267
|
-
// Mouse wheel zoom
|
268
|
-
container.addEventListener(
|
322
|
+
// Mouse wheel zoom
|
323
|
+
container.addEventListener("wheel", function(event) {{
|
269
324
|
event.preventDefault();
|
270
325
|
const zoomSpeed = 0.1;
|
271
|
-
const zoomDelta = event.deltaY > 0 ? -zoomSpeed : zoomSpeed;
|
272
326
|
const previousScale = scale;
|
273
327
|
|
274
|
-
//
|
275
|
-
|
328
|
+
// Update zoom level
|
329
|
+
if (event.deltaY < 0) {{
|
330
|
+
scale = Math.min(scale + zoomSpeed, 4); // Zoom in
|
331
|
+
}} else {{
|
332
|
+
scale = Math.max(scale - zoomSpeed, 0.5); // Zoom out
|
333
|
+
}}
|
276
334
|
|
277
|
-
//
|
335
|
+
// Adjust offsets for smooth zoom behavior
|
278
336
|
const rect = content.getBoundingClientRect();
|
279
337
|
const offsetX = event.clientX - rect.left;
|
280
338
|
const offsetY = event.clientY - rect.top;
|
281
|
-
|
282
|
-
// Adjust pan values to focus zoom on cursor
|
283
339
|
panX -= (offsetX / previousScale - offsetX / scale);
|
284
340
|
panY -= (offsetY / previousScale - offsetY / scale);
|
285
341
|
|
286
|
-
// Apply
|
287
|
-
content.style.transform = `translate(${panX}px, ${panY}px) scale(${scale})`;
|
342
|
+
// Apply zoom and pan
|
343
|
+
content.style.transform = `translate(${{panX}}px, ${{panY}}px) scale(${{scale}})`;
|
288
344
|
}});
|
289
345
|
|
290
|
-
//
|
291
|
-
container.addEventListener(
|
346
|
+
// Drag-to-pan functionality
|
347
|
+
container.addEventListener("mousedown", function(event) {{
|
292
348
|
isDragging = true;
|
293
349
|
startX = event.clientX - panX;
|
294
350
|
startY = event.clientY - panY;
|
295
351
|
container.style.cursor = "grabbing";
|
296
352
|
}});
|
297
353
|
|
298
|
-
container.addEventListener(
|
354
|
+
container.addEventListener("mousemove", function(event) {{
|
299
355
|
if (!isDragging) return;
|
300
356
|
panX = event.clientX - startX;
|
301
357
|
panY = event.clientY - startY;
|
302
358
|
|
303
|
-
// Apply
|
304
|
-
content.style.transform = `translate(${panX}px, ${panY}px) scale(${scale})`;
|
359
|
+
// Apply panning
|
360
|
+
content.style.transform = `translate(${{panX}}px, ${{panY}}px) scale(${{scale}})`;
|
305
361
|
}});
|
306
362
|
|
307
|
-
container.addEventListener(
|
363
|
+
container.addEventListener("mouseup", function() {{
|
308
364
|
isDragging = false;
|
309
365
|
container.style.cursor = "grab";
|
310
366
|
}});
|
311
367
|
|
312
|
-
container.addEventListener(
|
368
|
+
container.addEventListener("mouseleave", function() {{
|
313
369
|
isDragging = false;
|
314
370
|
container.style.cursor = "grab";
|
315
371
|
}});
|
316
372
|
}});
|
317
373
|
</script>
|
318
|
-
<style>
|
319
|
-
body {{
|
320
|
-
margin: 0;
|
321
|
-
padding: 0;
|
322
|
-
font-family: Arial, sans-serif;
|
323
|
-
}}
|
324
|
-
.pan-zoom-container {{
|
325
|
-
overflow: hidden;
|
326
|
-
position: relative;
|
327
|
-
width: 100%;
|
328
|
-
height: 100vh;
|
329
|
-
background-color: #f4f4f4;
|
330
|
-
}}
|
331
|
-
.pan-zoom-content {{
|
332
|
-
display: inline-block;
|
333
|
-
transform-origin: 0 0;
|
334
|
-
cursor: grab;
|
335
|
-
}}
|
336
|
-
.pan-zoom-content:active {{
|
337
|
-
cursor: grabbing;
|
338
|
-
}}
|
339
|
-
</style>
|
340
|
-
</head>
|
341
|
-
<body>
|
342
|
-
<title>{title_label}</title>
|
343
|
-
<h3>{title_label}</h3>
|
344
|
-
GUID : {guid}
|
345
|
-
<div class="pan-zoom-container">
|
346
|
-
<div id="{graph_id}" class="pan-zoom-content mermaid">
|
347
|
-
<!-- Placeholder for Mermaid.js -->
|
348
|
-
</div>
|
349
|
-
</div>
|
350
374
|
</body>
|
351
375
|
</html>
|
376
|
+
|
352
377
|
"""
|
353
378
|
|
379
|
+
|
354
380
|
return mermaid_html
|
355
381
|
|
356
382
|
|
@@ -502,7 +502,7 @@ pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3eu
|
|
502
502
|
pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kKyjvpDA,47464
|
503
503
|
pyegeria/glossary_browser_omvs.py,sha256=RCvZ1l2xg6uZ1o4xGJUkIVJQO9NZG00F_jGSc4fAERU,93538
|
504
504
|
pyegeria/glossary_manager_omvs.py,sha256=CN04lhnAFk_g4soE5V_jZ0GDrLPClhX5yX9iE0t6NDk,132440
|
505
|
-
pyegeria/mermaid_utilities.py,sha256=
|
505
|
+
pyegeria/mermaid_utilities.py,sha256=Qis4mlFgtzTZclq76JYyZM29f45sV4U2jMVJBjyk25Q,24016
|
506
506
|
pyegeria/metadata_explorer_omvs.py,sha256=u66o4IOhSo-i75KYeHogGql-gECBzZPT-RYbvfYuzoI,86932
|
507
507
|
pyegeria/my_profile_omvs.py,sha256=i0e29KXRKZzZGgxuQI7c2_w7dyDuQWFIykky1Nqc0_8,34673
|
508
508
|
pyegeria/platform_services.py,sha256=xlF5p5HPKDGTFFDsuxm2RLhr8vjZPv4T7e2qCkDgKXE,41654
|
@@ -515,8 +515,8 @@ pyegeria/template_manager_omvs.py,sha256=o_qCIFTRLK8b9C3N99taLji8VkDygo1Ss0fua35
|
|
515
515
|
pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
|
516
516
|
pyegeria/valid_metadata_omvs.py,sha256=UyIT4DfB1_QIG55Hmop7ozbsq8cNdrpYB7Tb6EOFiN8,65035
|
517
517
|
pyegeria/x_action_author_omvs.py,sha256=6b725SPsC52AI7ols7Qq8MsBlZuAXr_BgJ_-ychVRCw,6386
|
518
|
-
pyegeria-5.3.4.4.
|
519
|
-
pyegeria-5.3.4.4.
|
520
|
-
pyegeria-5.3.4.4.
|
521
|
-
pyegeria-5.3.4.4.
|
522
|
-
pyegeria-5.3.4.4.
|
518
|
+
pyegeria-5.3.4.4.dev7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
519
|
+
pyegeria-5.3.4.4.dev7.dist-info/METADATA,sha256=J0ZheVAVvscllfU27OVsDA-uBk5RGYa5zEGa3WNPMKY,2740
|
520
|
+
pyegeria-5.3.4.4.dev7.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
521
|
+
pyegeria-5.3.4.4.dev7.dist-info/entry_points.txt,sha256=E83aZ9RhrxffYGmHgBwhLdS5fvEeYhrIPp0FZRvaFOI,6180
|
522
|
+
pyegeria-5.3.4.4.dev7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|