pyegeria 5.3.4.15__py3-none-any.whl → 5.3.4.17__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.
@@ -223,7 +223,7 @@ def construct_mermaid_html(mermaid_str: str) -> str:
223
223
  """
224
224
  title_label, guid, mermaid_code = parse_mermaid_code(mermaid_str)
225
225
 
226
- graph_id = f"mermaid-graph-{guid}"
226
+ graph_id = f"mermaid-graph-{guid}-{str(uuid.uuid4())[:4]}"
227
227
  escaped_header = html.escape(title_label) if title_label else "" # Sanitize the header safely
228
228
  escaped_mermaid_code = html.escape(mermaid_code)
229
229
  header_html = f"""
@@ -236,162 +236,324 @@ def construct_mermaid_html(mermaid_str: str) -> str:
236
236
  """ if title_label else ""
237
237
 
238
238
  html_content = f"""
239
- <style>
240
- .diagram-container {{
241
- position: relative;
242
- width: 90%; /* Adjust container width */
243
- height: 500px; /* Fixed height */
244
- margin: 20px auto;
245
- border: 1px solid #ccc;
246
- overflow: hidden; /* Prevents content overflow */
247
- }}
248
-
249
- .svg-pan-zoom-controls {{
250
- position: absolute;
251
- top: 10px;
252
- right: 10px;
253
- display: flex;
254
- flex-direction: column;
255
- gap: 5px;
256
- z-index: 10;
257
- }}
258
-
259
- .svg-pan-zoom-controls button {{
260
- background-color: #007bff;
261
- color: white;
262
- border: none;
263
- padding: 5px 10px;
264
- border-radius: 3px;
265
- cursor: pointer;
266
- font-size: 14px;
267
- }}
268
- .svg-pan-zoom-controls button:hover {{
269
- background-color: #0056b3;
270
- }}
271
- </style>
272
-
273
- <div id="{graph_id}-container" class="diagram-container">
274
- <div id="{graph_id}" class="mermaid">
275
- {mermaid_code}
276
- </div>
239
+ <style>
240
+ /* Style for the diagram container */
241
+ .diagram-container {{
242
+ position: relative;
243
+ width: 100%; /* Adjust the diagram container width */
244
+ height: 500px; /* Set a fixed height for the container */
245
+ margin: 0 auto;
246
+ border: 1px solid #ccc; /* Optional border for visualization */
247
+ overflow: hidden; /* Prevent content overflow outside the container */
248
+ }}
249
+
250
+ /* Style for zoom controls */
251
+ .svg-pan-zoom_controls {{
252
+ position: absolute;
253
+ top: 10px;
254
+ right: 10px;
255
+ display: flex;
256
+ flex-direction: column;
257
+ gap: 5px;
258
+ }}
259
+ .svg-pan-zoom_controls button {{
260
+ background-color: #007bff;
261
+ color: white;
262
+ border: none;
263
+ padding: 5px 10px;
264
+ border-radius: 3px;
265
+ cursor: pointer;
266
+ font-size: 14px;
267
+ }}
268
+ .svg-pan-zoom_controls button:hover {{
269
+ background-color: #0056b3;
270
+ }}
271
+ </style>
272
+
273
+ <div id="{graph_id}-container" class="diagram-container">
274
+ <!-- Mermaid diagram will be dynamically rendered here -->
275
+ {header_html}
276
+ <div id="{graph_id}" class="mermaid">
277
+ {mermaid_code}
277
278
  </div>
279
+ </div>
278
280
 
281
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
282
+ <script src="https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"></script>
279
283
  <script>
280
- (function() {{
284
+ document.addEventListener("DOMContentLoaded", () => {{
285
+ // Initialize Mermaid and Pan-Zoom functionality
281
286
  const graph_id = "{graph_id}";
282
- let panZoomInstance; // Reference for svg-pan-zoom instance
283
287
 
284
288
  function initializeMermaid(graph_id) {{
285
- const container = document.getElementById(`${{graph_id}}-container`);
286
- const diagram = document.getElementById(`${{graph_id}}`);
289
+ const containerElement = document.getElementById(`${{graph_id}}-container`);
287
290
 
288
- if (!container || !diagram) {{
289
- console.error(`Container or diagram not found for ID "${{graph_id}}"`);
291
+ if (!containerElement) {{
292
+ console.error(`Container with ID "${{graph_id}}-container" not found.`);
290
293
  return;
291
294
  }}
292
295
 
293
- // Initialize Mermaid
294
- mermaid.initialize({{ startOnLoad: false }});
295
- mermaid.init(undefined, diagram);
296
+ // Configure Mermaid
297
+ mermaid.initialize({{ startOnLoad: false, logLevel: "debug" }});
298
+ mermaid.init(undefined, `#${{graph_id}}`);
296
299
 
297
- // Set a small delay to allow Mermaid rendering to complete
298
300
  setTimeout(() => {{
299
- const svg = container.querySelector("svg");
300
-
301
+ const svg = containerElement.querySelector("svg");
301
302
  if (!svg) {{
302
- console.error(`SVG not found for graph ID "${{graph_id}}"`);
303
+ console.error(`SVG not rendered for ID "${{graph_id}}".`);
303
304
  return;
304
305
  }}
305
306
 
306
- // Force SVG to fit the container
307
+ // Set initial size
307
308
  svg.setAttribute("width", "100%");
308
309
  svg.setAttribute("height", "100%");
309
- svg.setAttribute("preserveAspectRatio", "xMidYMid meet");
310
- svg.style.display = "block";
311
-
312
- if (!svg.hasAttribute("viewBox")) {{
313
- const bbox = svg.getBBox();
314
- svg.setAttribute("viewBox", `0 0 ${{bbox.width}} ${{bbox.height}}`);
315
- }}
316
310
 
317
311
  // Initialize Pan-Zoom
318
- panZoomInstance = svgPanZoom(svg, {{
312
+ const panZoom = svgPanZoom(svg, {{
319
313
  zoomEnabled: true,
320
- controlIconsEnabled: false, // Custom controls
314
+ controlIconsEnabled: false,
321
315
  fit: true,
322
316
  center: true,
323
- contain: true,
324
317
  minZoom: 0.5,
325
- maxZoom: 10
318
+ maxZoom: 10,
319
+ contain: true
326
320
  }});
327
321
 
328
- // Add controls
322
+ // Add custom controls
329
323
  const controlsContainer = document.createElement("div");
330
- controlsContainer.className = "svg-pan-zoom-controls";
324
+ controlsContainer.className = "svg-pan-zoom_controls";
331
325
  controlsContainer.innerHTML = `
332
- <button type="button" id="${{graph_id}}-zoom-in">+</button>
333
- <button type="button" id="${{graph_id}}-zoom-out">-</button>
334
- <button type="button" id="${{graph_id}}-reset">Reset</button>
326
+ <button id="${{graph_id}}-zoom-in">+</button>
327
+ <button id="${{graph_id}}-zoom-out">-</button>
328
+ <button id="${{graph_id}}-reset">Reset</button>
335
329
  `;
336
- container.appendChild(controlsContainer);
330
+ containerElement.appendChild(controlsContainer);
337
331
 
338
- // Attach control event listeners
339
- document.getElementById(`${{graph_id}}-zoom-in`).addEventListener("click", () => {{
340
- if (panZoomInstance) panZoomInstance.zoomIn();
341
- }});
342
- document.getElementById(`${{graph_id}}-zoom-out`).addEventListener("click", () => {{
343
- if (panZoomInstance) panZoomInstance.zoomOut();
344
- }});
332
+ // Handle controls
333
+ document.getElementById(`${{graph_id}}-zoom-in`).addEventListener("click", () => panZoom.zoomIn());
334
+ document.getElementById(`${{graph_id}}-zoom-out`).addEventListener("click", () => panZoom.zoomOut());
345
335
  document.getElementById(`${{graph_id}}-reset`).addEventListener("click", () => {{
346
- if (panZoomInstance) {{
347
- panZoomInstance.resetZoom();
348
- panZoomInstance.center();
349
- }}
336
+ panZoom.resetZoom();
337
+ panZoom.center();
350
338
  }});
351
- }}, 500); // Delay for Mermaid and SVG rendering
339
+ }}, 500);
352
340
  }}
353
341
 
354
- // Check if Mermaid and SVG-Pan-Zoom are loaded
355
- const loadMermaid = typeof mermaid === "undefined";
356
- const loadSvgPanZoom = typeof svgPanZoom === "undefined";
357
-
358
- if (loadMermaid || loadSvgPanZoom) {{
359
- const promises = [];
360
-
361
- // Load Mermaid.js if not already loaded
362
- if (loadMermaid) {{
363
- promises.push(new Promise((resolve) => {{
364
- const script = document.createElement("script");
365
- script.src = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
366
- script.onload = resolve;
367
- document.head.appendChild(script);
368
- }}));
369
- }}
370
-
371
- // Load SVG-Pan-Zoom if not already loaded
372
- if (loadSvgPanZoom) {{
373
- promises.push(new Promise((resolve) => {{
374
- const script = document.createElement("script");
375
- script.src = "https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js";
376
- script.onload = resolve;
377
- document.head.appendChild(script);
378
- }}));
379
- }}
380
-
381
- Promise.all(promises).then(() => initializeMermaid(graph_id));
342
+ if (typeof mermaid === "undefined") {{
343
+ const script = document.createElement('script');
344
+ script.src = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
345
+ script.onload = () => initializeMermaid(graph_id);
346
+ document.head.appendChild(script);
382
347
  }} else {{
383
348
  initializeMermaid(graph_id);
384
349
  }}
385
- }})();
350
+ }});
386
351
  </script>
387
352
 
388
- """
353
+ """
354
+ #
355
+ # return html_content
356
+ # This one almost works - no controls and diagram too small
357
+ # html_content = f"""
358
+ # <!DOCTYPE html>
359
+ # <html>
360
+ # <head>
361
+ # <style>
362
+ # /* Set consistent sizing and prevent shrinking for the container and parents */
363
+ # html, body, #{graph_id}-wrapper {{
364
+ # margin: 0;
365
+ # padding: 0;
366
+ # height: 100%; /* Ensure the entire root hierarchy respects 100% height */
367
+ # width: 100%;
368
+ # }}
369
+ #
370
+ # /* Ensure diagram container maintains full height and prevents overflow */
371
+ # #{graph_id}-container {{
372
+ # position: relative;
373
+ # width: 100%;
374
+ # height: 100%;
375
+ # overflow: hidden; /* Prevent content from breaking layout */
376
+ # display: flex;
377
+ # align-items: center; /* Centers the diagram vertically */
378
+ # justify-content: center; /* Centers the diagram horizontally */
379
+ # }}
380
+ #
381
+ # /* Ensure SVG always stretches to match container */
382
+ # #{graph_id} svg {{
383
+ # width: 100%;
384
+ # height: 100%;
385
+ # display: block; /* Avoid unwanted inline space issues */
386
+ # }}
387
+ #
388
+ # /* Optional custom pan/zoom controls (if dynamically added) */
389
+ # .svg-pan-zoom_controls {{
390
+ # position: absolute;
391
+ # bottom: 10px; /* Adjust based on desired placement */
392
+ # right: 10px;
393
+ # z-index: 10;
394
+ # display: flex;
395
+ # gap: 5px;
396
+ # }}
397
+ #
398
+ # .svg-pan-zoom_controls button {{
399
+ # border: 1px solid #ccc;
400
+ # background-color: #fff;
401
+ # color: #000;
402
+ # padding: 5px 10px;
403
+ # cursor: pointer;
404
+ # font-size: 16px;
405
+ # }}
406
+ #
407
+ # .svg-pan-zoom_controls button:hover {{
408
+ # background-color: #f0f0f0;
409
+ # }}
410
+ # </style>
411
+ # </head>
412
+ # <body>
413
+ # <div id="{graph_id}-wrapper">
414
+ # <!-- Title/Heading (optional; include as needed) -->
415
+ # {escaped_header if escaped_header else ""}
416
+ #
417
+ # <!-- Mermaid Diagram Container -->
418
+ # <div id="{graph_id}-container">
419
+ # <div id="{graph_id}" class="mermaid">
420
+ # {escaped_mermaid_code}
421
+ # </div>
422
+ # </div>
423
+ # </div>
424
+ #
425
+ # <script src="https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"></script>
426
+ # <script>
427
+ # document.addEventListener("DOMContentLoaded", () => {{
428
+ # // Define the graph ID dynamically passed via Python
429
+ # const graph_id = "{graph_id}";
430
+ #
431
+ # // Function to load external scripts dynamically
432
+ # function loadScript(url, callback) {{
433
+ # const script = document.createElement('script');
434
+ # script.src = url;
435
+ # script.async = true;
436
+ # script.onload = callback;
437
+ # script.onerror = () => console.error("Error loading script:", url);
438
+ # document.head.appendChild(script);
439
+ # }}
440
+ #
441
+ # // Function to initialize Mermaid
442
+ # function initializeMermaid(graph_id) {{
443
+ # // Look for the container ID generated dynamically by the template
444
+ # const containerElement = document.getElementById(`${{graph_id}}-container`);
445
+ # if (!containerElement) {{
446
+ # console.error(`Container element with id "${{graph_id}}-container" not found.`);
447
+ # return;
448
+ # }}
449
+ #
450
+ # // Initialize Mermaid.js with default configuration
451
+ # mermaid.initialize({{ startOnLoad: false, logLevel: "debug" }});
452
+ # mermaid.init(undefined, `#${{graph_id}}`); // Initialize element with id matching `graph_id`
453
+ #
454
+ # // Add a timeout to ensure the SVG is rendered
455
+ # setTimeout(() => {{
456
+ # const svg = containerElement.querySelector("svg");
457
+ #
458
+ # // Handle errors if SVG rendering fails
459
+ # if (!svg) {{
460
+ # console.error(`SVG not rendered for ID "${{graph_id}}". Check Mermaid syntax or rendering issues.`);
461
+ # console.log("Container content:", containerElement.innerHTML); // Log the container's content
462
+ # return;
463
+ # }}
464
+ #
465
+ # // Set SVG attributes for full container fit
466
+ # svg.setAttribute("width", "100%");
467
+ # svg.setAttribute("height", "100%");
468
+ #
469
+ # // Initialize SVG Pan-Zoom functionality
470
+ # const panZoom = svgPanZoom(svg, {{
471
+ # zoomEnabled: true,
472
+ # controlIconsEnabled: true, // Display default controls if enabled
473
+ # fit: true, // Fit diagram within the container
474
+ # center: true, // Center the diagram
475
+ # minZoom: 0.5, // Prevent too much zooming out
476
+ # maxZoom: 10, // Prevent extreme zooming in
477
+ # contain: true // Keep the diagram fully within bounds
478
+ # }});
479
+ #
480
+ # // Optional: Add custom pan/zoom controls dynamically
481
+ # const controlsContainer = document.createElement("div");
482
+ # controlsContainer.classList.add("svg-pan-zoom_controls");
483
+ # controlsContainer.innerHTML = `
484
+ # <button id="${{graph_id}}-zoom-in">+</button>
485
+ # <button id="${{graph_id}}-zoom-out">-</button>
486
+ # <button id="${{graph_id}}-reset">Reset</button>
487
+ # `;
488
+ # containerElement.appendChild(controlsContainer);
489
+ #
490
+ # // Add event listeners for the custom controls
491
+ # document.getElementById(`${{graph_id}}-zoom-in`).addEventListener("click", () => panZoom.zoomIn());
492
+ # document.getElementById(`${{graph_id}}-zoom-out`).addEventListener("click", () => panZoom.zoomOut());
493
+ # document.getElementById(`${{graph_id}}-reset`).addEventListener("click", () => {{
494
+ # panZoom.resetZoom();
495
+ # panZoom.center();
496
+ # }});
497
+ # }}, 500); // Short delay to ensure SVG rendering is complete
498
+ # }}
499
+ #
500
+ # // Load Mermaid.js if not already loaded
501
+ # if (typeof mermaid === "undefined") {{
502
+ # loadScript("https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js", () => {{
503
+ # console.log("Mermaid.js loaded successfully");
504
+ # initializeMermaid(graph_id); // Call initialization after Mermaid.js is loaded
505
+ # }});
506
+ # }} else {{
507
+ # initializeMermaid(graph_id); // If Mermaid.js is already loaded, proceed immediately
508
+ # }}
509
+ # }});
510
+ # </script>
511
+ #
512
+ #
513
+ # </body>
514
+ # </html>
515
+ # """
516
+
389
517
 
390
518
 
391
519
 
392
520
 
393
521
  return html_content
394
522
 
523
+ # // Check if Mermaid and SVG-Pan-Zoom are loaded
524
+ # const loadMermaid = typeof mermaid === "undefined";
525
+ # const loadSvgPanZoom = typeof svgPanZoom === "undefined";
526
+ #
527
+ # if (loadMermaid || loadSvgPanZoom) {{
528
+ # const promises = [];
529
+ #
530
+ # // Load Mermaid.js if not already loaded
531
+ # if (loadMermaid) {{
532
+ # promises.push(new Promise((resolve) => {{
533
+ # const script = document.createElement("script");
534
+ # script.src = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
535
+ # script.onload = resolve;
536
+ # document.head.appendChild(script);
537
+ # }}));
538
+ # }}
539
+ #
540
+ # // Load SVG-Pan-Zoom if not already loaded
541
+ # if (loadSvgPanZoom) {{
542
+ # promises.push(new Promise((resolve) => {{
543
+ # const script = document.createElement("script");
544
+ # script.src = "https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js";
545
+ # script.onload = resolve;
546
+ # document.head.appendChild(script);
547
+ # }}));
548
+ # }}
549
+ #
550
+ # Promise.all(promises).then(() => initializeMermaid(graph_id));
551
+ # }} else {{
552
+ # initializeMermaid(graph_id);
553
+ # }}
554
+ # }})();
555
+
556
+
395
557
  # html_content = f"""
396
558
  # <style>
397
559
  # /* Style for the diagram container */
pyegeria/test_m.html CHANGED
@@ -1,53 +1,50 @@
1
1
 
2
2
  <style>
3
- /* Style the diagram container */
4
- .diagram-container {
5
- position: relative;
6
- width: 90%; /* Adjust container width */
7
- height: 500px; /* Fixed height */
8
- margin: 0 auto;
9
- border: 1px solid #ccc;
10
- overflow: hidden; /* Prevents content overflow */
11
- }
12
-
13
- /* Style custom zoom controls */
14
- .svg-pan-zoom-controls {
15
- position: absolute;
16
- top: 10px;
17
- right: 10px;
18
- display: flex;
19
- flex-direction: column;
20
- gap: 5px;
21
- z-index: 10; /* Ensures controls are above other elements */
22
- }
23
-
24
- .svg-pan-zoom-controls button {
25
- background-color: #007bff;
26
- color: white;
27
- border: none;
28
- padding: 5px 10px;
29
- border-radius: 3px;
30
- cursor: pointer;
31
- font-size: 14px;
32
- }
33
- .svg-pan-zoom-controls button:hover {
34
- background-color: #0056b3;
35
- }
36
- </style>
37
-
38
- <div id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-container" class="diagram-container">
39
- <!-- Title/Heading (optional; include as needed) -->
40
-
41
- <h3 id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-heading" style="margin: 20px 0; font-size: 1.5em; text-align: center;">
3
+ /* Style for the diagram container */
4
+ .diagram-container {
5
+ position: relative;
6
+ width: 100%; /* Adjust the diagram container width */
7
+ height: 500px; /* Set a fixed height for the container */
8
+ margin: 0 auto;
9
+ border: 1px solid #ccc; /* Optional border for visualization */
10
+ overflow: hidden; /* Prevent content overflow outside the container */
11
+ }
12
+
13
+ /* Style for zoom controls */
14
+ .svg-pan-zoom_controls {
15
+ position: absolute;
16
+ top: 10px;
17
+ right: 10px;
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 5px;
21
+ }
22
+ .svg-pan-zoom_controls button {
23
+ background-color: #007bff;
24
+ color: white;
25
+ border: none;
26
+ padding: 5px 10px;
27
+ border-radius: 3px;
28
+ cursor: pointer;
29
+ font-size: 14px;
30
+ }
31
+ .svg-pan-zoom_controls button:hover {
32
+ background-color: #0056b3;
33
+ }
34
+ </style>
35
+
36
+ <div id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-597f-container" class="diagram-container">
37
+ <!-- Mermaid diagram will be dynamically rendered here -->
38
+
39
+ <h3 id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-597f-heading" style="margin: 20px 0; font-size: 1.5em; text-align: center;">
42
40
  Component for Solution Blueprint - Clinical Trial Management Solution Blueprint
43
41
  </h3>
44
- <p id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-subheading" style="margin: 0; padding: 5px; font-size: 1em; text-align: center; color: gray; flex: 0 0 auto;">
42
+ <p id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-597f-subheading" style="margin: 0; padding: 5px; font-size: 1em; text-align: center; color: gray; flex: 0 0 auto;">
45
43
  GUID: c4f8d707-7c85-4125-b5fd-c3257a2ef2ef
46
44
  </p>
47
45
 
48
- <!-- Mermaid rendering area -->
49
- <div id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef" class="mermaid">
50
- flowchart TD
46
+ <div id="mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-597f" class="mermaid">
47
+ flowchart TD
51
48
  %%{init: {"flowchart": {"htmlLabels": false}} }%%
52
49
 
53
50
  subgraph c4f8d707-7c85-4125-b5fd-c3257a2ef2ef [Components and Actors]
@@ -148,96 +145,78 @@ style f6bc847b-868d-43cc-b767-41f5fe3e47d1 color:#FFFFFF, fill:#AA00FF, stroke:#
148
145
  style d48f579f-76d3-4c49-b1b4-575f5645a9d0 color:#FFFFFF, fill:#838cc7, stroke:#3079ab
149
146
  style f37f3735-28a1-4e03-9ff5-3fe2f137f661 color:#FFFFFF, fill:#AA00FF, stroke:#E1D5E7
150
147
  style fb32bef2-e79f-4893-b500-2e547f24d482 color:#FFFFFF, fill:#838cc7, stroke:#3079ab
151
- </div>
152
148
  </div>
149
+ </div>
153
150
 
154
- <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
151
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
155
152
  <script src="https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"></script>
156
-
157
153
  <script>
158
- (function() {
159
- const graph_id = "mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef";
160
- let panZoomInstance; // Store reference to the panZoom instance
154
+ document.addEventListener("DOMContentLoaded", () => {
155
+ // Initialize Mermaid and Pan-Zoom functionality
156
+ const graph_id = "mermaid-graph-c4f8d707-7c85-4125-b5fd-c3257a2ef2ef-597f";
161
157
 
162
- // Function to initialize Mermaid
163
158
  function initializeMermaid(graph_id) {
164
- const container = document.getElementById(`${graph_id}-container`);
165
- const diagram = document.getElementById(`${graph_id}`);
159
+ const containerElement = document.getElementById(`${graph_id}-container`);
166
160
 
167
- if (!container || !diagram) {
168
- console.error(`Container or diagram not found for ID "${graph_id}"`);
161
+ if (!containerElement) {
162
+ console.error(`Container with ID "${graph_id}-container" not found.`);
169
163
  return;
170
164
  }
171
165
 
172
- // Initialize Mermaid
173
- mermaid.initialize({ startOnLoad: false });
174
- mermaid.init(undefined, diagram);
166
+ // Configure Mermaid
167
+ mermaid.initialize({ startOnLoad: false, logLevel: "debug" });
168
+ mermaid.init(undefined, `#${graph_id}`);
175
169
 
176
- // Set a small delay to allow Mermaid rendering to complete before initializing Pan-Zoom
177
170
  setTimeout(() => {
178
- const svg = container.querySelector("svg");
171
+ const svg = containerElement.querySelector("svg");
179
172
  if (!svg) {
180
- console.error(`SVG not found for graph ID "${graph_id}"`);
173
+ console.error(`SVG not rendered for ID "${graph_id}".`);
181
174
  return;
182
175
  }
183
176
 
184
- // Force the SVG to fit the container by setting width, height, and viewBox
177
+ // Set initial size
185
178
  svg.setAttribute("width", "100%");
186
179
  svg.setAttribute("height", "100%");
187
- svg.setAttribute("preserveAspectRatio", "xMidYMid meet");
188
- svg.style.display = "block";
189
180
 
190
- if (!svg.hasAttribute("viewBox")) {
191
- const bbox = svg.getBBox();
192
- svg.setAttribute("viewBox", `0 0 ${bbox.width} ${bbox.height}`);
193
- }
194
-
195
- // Initialize Pan-Zoom functionality
196
- panZoomInstance = svgPanZoom(svg, {
181
+ // Initialize Pan-Zoom
182
+ const panZoom = svgPanZoom(svg, {
197
183
  zoomEnabled: true,
198
- controlIconsEnabled: false, // Use custom controls
184
+ controlIconsEnabled: false,
199
185
  fit: true,
200
186
  center: true,
201
- contain: true,
202
187
  minZoom: 0.5,
203
- maxZoom: 10
188
+ maxZoom: 10,
189
+ contain: true
204
190
  });
205
191
 
206
192
  // Add custom controls
207
193
  const controlsContainer = document.createElement("div");
208
- controlsContainer.className = "svg-pan-zoom-controls";
194
+ controlsContainer.className = "svg-pan-zoom_controls";
209
195
  controlsContainer.innerHTML = `
210
- <button type="button" id="${graph_id}-zoom-in">+</button>
211
- <button type="button" id="${graph_id}-zoom-out">-</button>
212
- <button type="button" id="${graph_id}-reset">Reset</button>
196
+ <button id="${graph_id}-zoom-in">+</button>
197
+ <button id="${graph_id}-zoom-out">-</button>
198
+ <button id="${graph_id}-reset">Reset</button>
213
199
  `;
214
- container.appendChild(controlsContainer);
200
+ containerElement.appendChild(controlsContainer);
215
201
 
216
- // Add event listeners for the controls
217
- document.getElementById(`${graph_id}-zoom-in`).addEventListener("click", () => {
218
- if (panZoomInstance) panZoomInstance.zoomIn();
219
- });
220
- document.getElementById(`${graph_id}-zoom-out`).addEventListener("click", () => {
221
- if (panZoomInstance) panZoomInstance.zoomOut();
222
- });
202
+ // Handle controls
203
+ document.getElementById(`${graph_id}-zoom-in`).addEventListener("click", () => panZoom.zoomIn());
204
+ document.getElementById(`${graph_id}-zoom-out`).addEventListener("click", () => panZoom.zoomOut());
223
205
  document.getElementById(`${graph_id}-reset`).addEventListener("click", () => {
224
- if (panZoomInstance) {
225
- panZoomInstance.resetZoom();
226
- panZoomInstance.center();
227
- }
206
+ panZoom.resetZoom();
207
+ panZoom.center();
228
208
  });
229
- }, 500); // Delay of 500ms for Mermaid and SVG rendering
209
+ }, 500);
230
210
  }
231
211
 
232
- // Load Mermaid.js if not already loaded
233
212
  if (typeof mermaid === "undefined") {
234
- const script = document.createElement("script");
213
+ const script = document.createElement('script');
235
214
  script.src = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js";
236
215
  script.onload = () => initializeMermaid(graph_id);
237
216
  document.head.appendChild(script);
238
217
  } else {
239
218
  initializeMermaid(graph_id);
240
219
  }
241
- })();
220
+ });
242
221
  </script>
243
-
222
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyegeria
3
- Version: 5.3.4.15
3
+ Version: 5.3.4.17
4
4
  Summary: A python client for Egeria
5
5
  License: Apache 2.0
6
6
  Keywords: egeria,metadata,governance
@@ -245,7 +245,7 @@ pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kK
245
245
  pyegeria/glossary_browser_omvs.py,sha256=ci57LXFjIAXWw6XXFu8pIbeR_3y4hl_x4F2-HHdy7VM,93585
246
246
  pyegeria/glossary_manager_omvs.py,sha256=GJQo5E3bxv8JL84wTGqJKMrMo7QqNAPtyJJgvGpI_lU,132558
247
247
  pyegeria/m_test.py,sha256=BDKRLsHsAWnwCbzHkkvfsc8ZIJ0k-jmwPPNuTSgW6Qo,7659
248
- pyegeria/mermaid_utilities.py,sha256=eIQ21z8KuoeKWkDLChvU_f3O-33sFah67Vaks0Oaj0g,40651
248
+ pyegeria/mermaid_utilities.py,sha256=kYpvtkkaygmlWxQBQ81Cvg8DmJU9kSQ4TJsatEbJxig,47100
249
249
  pyegeria/metadata_explorer_omvs.py,sha256=xHnZTQKbd6XwOhYia-RiIisrvZcqHi0SL1l6OCf04Gk,86911
250
250
  pyegeria/my_profile_omvs.py,sha256=d0oJYCJG7pS9BINPuGciVa00ac0jwPHNANXDCLginEc,34720
251
251
  pyegeria/platform_services.py,sha256=xlF5p5HPKDGTFFDsuxm2RLhr8vjZPv4T7e2qCkDgKXE,41654
@@ -255,14 +255,14 @@ pyegeria/runtime_manager_omvs.py,sha256=Z5wY9ignNjil8O6yjihZftxkGoh9A4PQDcXhoIsO
255
255
  pyegeria/server_operations.py,sha256=vmiUDU_Xa0U8pa0Fdb-QKkoeSqs7WfMwIpG_XU3xgeI,16784
256
256
  pyegeria/solution_architect_omvs.py,sha256=x6CfPTyn1l2DFYVEFP0t_rT9uVjoFr596hBBeuVaMRg,22093
257
257
  pyegeria/template_manager_omvs.py,sha256=PfJ9dOfmBvf59DgRdZ9Dl1Kl_UYqjF-JncXVnbCqLZU,42408
258
- pyegeria/test_m.html,sha256=equ-hAZ8yn8g5pzzmslQaO_k75GWaWg9OxeHpCBG_4U,13531
258
+ pyegeria/test_m.html,sha256=soiG6-8OOl9iY8MLM1BohV2ySPn5cKmlubbGPS9WYZ8,12368
259
259
  pyegeria/test_m1.html,sha256=XS_1IAtfG4ZlZk45QTkrFWWpjQMVlO21ScDMX2Frl3g,14086
260
260
  pyegeria/test_mer.ipynb,sha256=G7hpHn07IXnt_VKvnTDvljwwHB7RfC0etOMyZKt1icQ,30809
261
261
  pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
262
262
  pyegeria/valid_metadata_omvs.py,sha256=kL3bEkoBtNCaQKjziFwRAqQyleu-i2ua_REIogfulFw,65031
263
263
  pyegeria/x_action_author_omvs.py,sha256=6b725SPsC52AI7ols7Qq8MsBlZuAXr_BgJ_-ychVRCw,6386
264
- pyegeria-5.3.4.15.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
265
- pyegeria-5.3.4.15.dist-info/METADATA,sha256=MCI6Baa0OgGreARNDJm282wBYOBxfgw1WoQx-HZgK_E,2736
266
- pyegeria-5.3.4.15.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
267
- pyegeria-5.3.4.15.dist-info/entry_points.txt,sha256=LS9g5JPSBL0whnyAcGhLZCAyUp6PkPU6fjHP9Aso1V4,6176
268
- pyegeria-5.3.4.15.dist-info/RECORD,,
264
+ pyegeria-5.3.4.17.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
265
+ pyegeria-5.3.4.17.dist-info/METADATA,sha256=WENOLlCzIWk66GeM10kKHrcxBP2YjkoAsx0CUfDAbAU,2736
266
+ pyegeria-5.3.4.17.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
267
+ pyegeria-5.3.4.17.dist-info/entry_points.txt,sha256=LS9g5JPSBL0whnyAcGhLZCAyUp6PkPU6fjHP9Aso1V4,6176
268
+ pyegeria-5.3.4.17.dist-info/RECORD,,