staticdash 2026.5__tar.gz → 2026.6__tar.gz

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.
Files changed (25) hide show
  1. {staticdash-2026.5 → staticdash-2026.6}/PKG-INFO +1 -1
  2. {staticdash-2026.5 → staticdash-2026.6}/pyproject.toml +1 -1
  3. {staticdash-2026.5 → staticdash-2026.6}/staticdash/dashboard.py +73 -24
  4. {staticdash-2026.5 → staticdash-2026.6}/staticdash.egg-info/PKG-INFO +1 -1
  5. {staticdash-2026.5 → staticdash-2026.6}/README.md +0 -0
  6. {staticdash-2026.5 → staticdash-2026.6}/setup.cfg +0 -0
  7. {staticdash-2026.5 → staticdash-2026.6}/setup.py +0 -0
  8. {staticdash-2026.5 → staticdash-2026.6}/staticdash/__init__.py +0 -0
  9. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/css/style.css +0 -0
  10. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/js/script.js +0 -0
  11. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/mathjax/tex-mml-chtml.js +0 -0
  12. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/plotly/plotly.min.js +0 -0
  13. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-bash.min.js +0 -0
  14. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-c.min.js +0 -0
  15. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-javascript.min.js +0 -0
  16. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-json.min.js +0 -0
  17. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-markup.min.js +0 -0
  18. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-python.min.js +0 -0
  19. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/components/prism-sql.min.js +0 -0
  20. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/prism-tomorrow.min.css +0 -0
  21. {staticdash-2026.5 → staticdash-2026.6}/staticdash/assets/vendor/prism/prism.min.js +0 -0
  22. {staticdash-2026.5 → staticdash-2026.6}/staticdash.egg-info/SOURCES.txt +0 -0
  23. {staticdash-2026.5 → staticdash-2026.6}/staticdash.egg-info/dependency_links.txt +0 -0
  24. {staticdash-2026.5 → staticdash-2026.6}/staticdash.egg-info/requires.txt +0 -0
  25. {staticdash-2026.5 → staticdash-2026.6}/staticdash.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staticdash
3
- Version: 2026.5
3
+ Version: 2026.6
4
4
  Summary: A lightweight static HTML dashboard generator with Plotly and pandas support.
5
5
  Author-email: Brian Day <brian.day1@gmail.com>
6
6
  License: CC0-1.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "staticdash"
7
- version = "2026.5"
7
+ version = "2026.6"
8
8
  description = "A lightweight static HTML dashboard generator with Plotly and pandas support."
9
9
  authors = [
10
10
  { name = "Brian Day", email = "brian.day1@gmail.com" }
@@ -12,6 +12,7 @@ import io
12
12
  import base64
13
13
  import matplotlib
14
14
  from matplotlib import rc_context
15
+ import json
15
16
 
16
17
  def split_paragraphs_preserving_math(text):
17
18
  """
@@ -210,21 +211,43 @@ class Page(AbstractPage):
210
211
  except Exception:
211
212
  pass
212
213
 
213
- # If a local vendored Plotly exists, rely on the head script.
214
- # Otherwise include Plotly from CDN so the inline newPlot call works.
215
- # Always rely on the page-level Plotly include (head). Avoid
216
- # embedding another Plotly bundle inside each fragment which
217
- # can lead to multiple conflicting versions in the same page.
218
- plotly_html = fig.to_html(full_html=False, include_plotlyjs=False, config={'responsive': True})
219
-
220
- # Wrap the Plotly HTML in a container with explicit pixel sizing
221
- container_style = "width:100%;"
222
- if specified_width is not None:
223
- container_style = f"width:{specified_width}px;"
224
- if specified_height is not None:
225
- container_style = container_style + f" height:{specified_height}px;"
214
+ # Defer Plotly.newPlot until the Plotly bundle is available
215
+ # by embedding the figure JSON and calling newPlot from a
216
+ # small loader that polls for `window.Plotly`.
217
+ try:
218
+ fig_json = fig.to_json()
219
+ except Exception:
220
+ # Fallback: use the html fragment (older path)
221
+ plotly_html = fig.to_html(full_html=False, include_plotlyjs=False, config={'responsive': True})
222
+ container_style = "width:100%;"
223
+ if specified_width is not None:
224
+ container_style = f"width:{specified_width}px;"
225
+ if specified_height is not None:
226
+ container_style = container_style + f" height:{specified_height}px;"
227
+ plot_wrapped = f'<div style="{container_style}">{plotly_html}</div>'
228
+ else:
229
+ fig_json = fig_json.replace('</script>', '<\\/script>')
230
+ div_id = f'plot-{uuid.uuid4()}'
231
+ container_style = "width:100%;"
232
+ if specified_width is not None:
233
+ container_style = f"width:{specified_width}px;"
234
+ if specified_height is not None:
235
+ container_style = container_style + f" height:{specified_height}px;"
236
+
237
+ plot_div = f'<div id="{div_id}" class="plotly-graph-div" style="{container_style}"></div>'
238
+ loader = (
239
+ '<script type="text/javascript">(function(){' \
240
+ f'var fig = {fig_json};' \
241
+ 'function tryPlot(){' \
242
+ 'if(window.Plotly && typeof window.Plotly.newPlot === "function"){' \
243
+ f'Plotly.newPlot("{div_id}", fig.data, fig.layout, {json.dumps({"responsive": True})});' \
244
+ '} else { setTimeout(tryPlot, 50); }' \
245
+ '}' \
246
+ 'if(document.readyState === "complete"){ tryPlot(); } else { window.addEventListener("load", tryPlot); }' \
247
+ '})();</script>'
248
+ )
249
+ plot_wrapped = plot_div + loader
226
250
 
227
- plot_wrapped = f'<div style="{container_style}">{plotly_html}</div>'
228
251
  # Apply alignment wrapper
229
252
  if specified_align not in ("left", "right", "center"):
230
253
  specified_align = "center"
@@ -427,16 +450,42 @@ class MiniPage(AbstractPage):
427
450
  except Exception:
428
451
  pass
429
452
 
430
- # Always rely on the page-level Plotly include (head). Avoid
431
- # embedding another Plotly bundle inside each fragment which
432
- # can lead to multiple conflicting versions in the same page.
433
- plotly_html = fig.to_html(full_html=False, include_plotlyjs=False, config={'responsive': True})
434
- container_style = "width:100%;"
435
- if specified_width is not None:
436
- container_style = f"width:{specified_width}px;"
437
- if specified_height is not None:
438
- container_style = container_style + f" height:{specified_height}px;"
439
- plot_wrapped = f'<div style="{container_style}">{plotly_html}</div>'
453
+ # Defer Plotly.newPlot until the Plotly bundle is available
454
+ # by embedding the figure JSON and calling newPlot from a
455
+ # small loader that polls for `window.Plotly`.
456
+ try:
457
+ fig_json = fig.to_json()
458
+ except Exception:
459
+ # Fallback: use the html fragment (older path)
460
+ plotly_html = fig.to_html(full_html=False, include_plotlyjs=False, config={'responsive': True})
461
+ container_style = "width:100%;"
462
+ if specified_width is not None:
463
+ container_style = f"width:{specified_width}px;"
464
+ if specified_height is not None:
465
+ container_style = container_style + f" height:{specified_height}px;"
466
+ plot_wrapped = f'<div style="{container_style}">{plotly_html}</div>'
467
+ else:
468
+ fig_json = fig_json.replace('</script>', '<\\/script>')
469
+ div_id = f'plot-{uuid.uuid4()}'
470
+ container_style = "width:100%;"
471
+ if specified_width is not None:
472
+ container_style = f"width:{specified_width}px;"
473
+ if specified_height is not None:
474
+ container_style = container_style + f" height:{specified_height}px;"
475
+
476
+ plot_div = f'<div id="{div_id}" class="plotly-graph-div" style="{container_style}"></div>'
477
+ loader = (
478
+ '<script type="text/javascript">(function(){' \
479
+ f'var fig = {fig_json};' \
480
+ 'function tryPlot(){' \
481
+ 'if(window.Plotly && typeof window.Plotly.newPlot === "function"){' \
482
+ f'Plotly.newPlot("{div_id}", fig.data, fig.layout, {json.dumps({"responsive": True})});' \
483
+ '} else { setTimeout(tryPlot, 50); }' \
484
+ '}' \
485
+ 'if(document.readyState === "complete"){ tryPlot(); } else { window.addEventListener("load", tryPlot); }' \
486
+ '})();</script>'
487
+ )
488
+ plot_wrapped = plot_div + loader
440
489
  if specified_align not in ("left", "right", "center"):
441
490
  specified_align = "center"
442
491
  if specified_align == "center":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staticdash
3
- Version: 2026.5
3
+ Version: 2026.6
4
4
  Summary: A lightweight static HTML dashboard generator with Plotly and pandas support.
5
5
  Author-email: Brian Day <brian.day1@gmail.com>
6
6
  License: CC0-1.0
File without changes
File without changes
File without changes