staticdash 0.4.1__py3-none-any.whl → 0.4.2__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.
@@ -1,45 +1,49 @@
1
1
  body {
2
+ display: flex;
3
+ flex-direction: row;
4
+ min-height: 100vh;
2
5
  margin: 0;
3
6
  font-family: sans-serif;
4
- background-color: #ffffff;
7
+ background-color: #f9f9f9;
5
8
  color: #333;
6
- display: flex;
7
- min-height: 100vh;
8
9
  }
9
10
 
10
- /* Sidebar */
11
11
  #sidebar {
12
+ position: fixed;
13
+ left: 0;
14
+ top: 0;
12
15
  width: 240px;
13
- background-color: #ffffff;
14
- border-right: 1px solid #ccc;
15
- padding: 20px;
16
+ height: 100vh;
17
+ background-color: #2c3e50;
18
+ padding: 20px 20px 60px 20px;
16
19
  box-sizing: border-box;
17
20
  overflow-y: auto;
18
- position: sticky;
19
- top: 0;
20
- height: 100vh;
21
- display: flex;
22
- flex-direction: column;
21
+ scrollbar-width: thin;
22
+ scrollbar-color: #888 #2c3e50;
23
+ }
24
+
25
+ #sidebar::-webkit-scrollbar {
26
+ width: 6px;
27
+ }
28
+
29
+ #sidebar::-webkit-scrollbar-track {
30
+ background: #2c3e50;
31
+ }
32
+
33
+ #sidebar::-webkit-scrollbar-thumb {
34
+ background-color: #888;
35
+ border-radius: 3px;
23
36
  }
24
37
 
25
- /* Sidebar header */
26
38
  #sidebar h1 {
27
- color: #2c3e50;
39
+ color: #ecf0f1;
28
40
  font-size: 20px;
29
41
  margin-bottom: 20px;
30
42
  }
31
43
 
32
- /* Nav links container */
33
- #sidebar .nav-links {
34
- flex-grow: 1;
35
- display: flex;
36
- flex-direction: column;
37
- }
38
-
39
- /* Nav links */
40
44
  .nav-link {
41
45
  display: block;
42
- color: #2c3e50;
46
+ color: #bdc3c7;
43
47
  text-decoration: none;
44
48
  margin: 10px 0;
45
49
  font-weight: bold;
@@ -49,7 +53,8 @@ body {
49
53
  }
50
54
 
51
55
  .nav-link:hover {
52
- background-color: #ecf0f1;
56
+ color: #ffffff;
57
+ background-color: #34495e;
53
58
  }
54
59
 
55
60
  .nav-link.active {
@@ -57,14 +62,16 @@ body {
57
62
  background-color: #1abc9c;
58
63
  }
59
64
 
60
- /* Sidebar footer */
61
65
  #sidebar-footer {
66
+ position: fixed;
67
+ bottom: 20px;
68
+ left: 20px;
69
+ width: 200px;
62
70
  font-size: 12px;
63
71
  color: #7f8c8d;
64
72
  text-align: center;
65
73
  line-height: 1.4;
66
- padding-top: 20px;
67
- border-top: 1px solid #ccc;
74
+ background-color: #2c3e50;
68
75
  }
69
76
 
70
77
  #sidebar-footer a {
@@ -76,35 +83,67 @@ body {
76
83
  text-decoration: underline;
77
84
  }
78
85
 
79
- /* Wrapper */
80
- #wrapper {
81
- flex: 1;
82
- background-color: #ffffff;
83
- overflow-x: hidden;
86
+ #content {
87
+ flex: 1 1 auto;
84
88
  display: flex;
85
89
  flex-direction: column;
86
- }
87
-
88
- #wrapper-inner {
89
- max-width: 2200px;
90
- margin: 0 auto;
91
90
  padding: 20px;
92
91
  box-sizing: border-box;
92
+ min-height: 100vh;
93
+ margin-left: 240px;
94
+ overflow-x: auto;
95
+ min-width: 0; /* Allow shrinking below 900px */
93
96
  }
94
97
 
95
- #content {
98
+ .content-inner {
99
+ max-width: 900px;
96
100
  width: 100%;
97
- box-sizing: border-box;
101
+ min-width: 0;
102
+ margin: 0 auto;
103
+ display: flex;
104
+ flex-direction: column;
105
+ min-height: 100vh;
106
+ }
107
+
108
+ @media (max-width: 1200px) {
109
+ #content {
110
+ max-width: 98vw;
111
+ }
112
+ }
113
+
114
+ @media (max-width: 940px) {
115
+ #content {
116
+ /* Keep margin-left: 240px; so content never jumps under sidebar */
117
+ min-width: 0;
118
+ padding: 10px;
119
+ }
120
+ .content-inner {
121
+ max-width: 100vw;
122
+ min-width: 0;
123
+ width: 100%;
124
+ overflow-x: auto;
125
+ }
126
+ }
127
+
128
+ @media (max-width: 800px) {
129
+ #content {
130
+ overflow-x: auto;
131
+ }
132
+ .content-inner {
133
+ width: 900px;
134
+ min-width: 900px;
135
+ max-width: 900px;
136
+ }
98
137
  }
99
138
 
100
139
  .page-section {
101
140
  display: none;
102
- max-width: 100%;
103
- overflow-x: auto;
141
+ width: 100%;
104
142
  }
105
143
 
106
144
  .page-section.active {
107
145
  display: block;
146
+ width: 100%;
108
147
  }
109
148
 
110
149
  .plot-container {
@@ -123,7 +162,7 @@ table {
123
162
  border-collapse: collapse;
124
163
  margin-top: 1em;
125
164
  background-color: white;
126
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
165
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
127
166
  overflow-x: auto;
128
167
  }
129
168
 
@@ -132,7 +171,8 @@ thead {
132
171
  color: white;
133
172
  }
134
173
 
135
- th, td {
174
+ th,
175
+ td {
136
176
  padding: 10px;
137
177
  border: 1px solid #ddd;
138
178
  text-align: left;
@@ -146,14 +186,12 @@ tbody tr:hover {
146
186
  background-color: #e8f0fe;
147
187
  }
148
188
 
149
- /* Images */
150
189
  .dash-image {
151
190
  max-width: 100%;
152
191
  height: auto;
153
192
  margin: 1em 0;
154
193
  }
155
194
 
156
- /* Download Button */
157
195
  .download-button {
158
196
  display: inline-block;
159
197
  padding: 0.5em 1em;
@@ -169,7 +207,7 @@ tbody tr:hover {
169
207
  background-color: #547a9f;
170
208
  }
171
209
 
172
- /* Sortable Table Headers */
210
+ /* Sortable Tables */
173
211
  table.sortable th {
174
212
  cursor: pointer;
175
213
  position: relative;
@@ -186,21 +224,20 @@ table.sortable th::after {
186
224
  }
187
225
 
188
226
  table.sortable th.sorted-asc::after {
189
- content: "";
227
+ content: "\25B2";
190
228
  }
191
229
 
192
230
  table.sortable th.sorted-desc::after {
193
- content: "";
231
+ content: "\25BC";
194
232
  }
195
233
 
196
234
  /* MiniPage Layout */
197
235
  .minipage-row {
198
236
  display: flex;
237
+ width: 100%;
199
238
  gap: 20px;
200
239
  margin-bottom: 20px;
201
- max-width: 100%;
202
240
  box-sizing: border-box;
203
- overflow-x: auto;
204
241
  }
205
242
 
206
243
  .minipage-cell {
@@ -222,7 +259,8 @@ table.sortable th.sorted-desc::after {
222
259
  }
223
260
 
224
261
  .minipage-cell .syntax-block {
225
- margin: .5em 0;
262
+ margin-top: 0.5em;
263
+ margin-bottom: 0.5em;
226
264
  }
227
265
 
228
266
  .minipage-cell table {
@@ -246,8 +284,8 @@ table.sortable th.sorted-desc::after {
246
284
  padding: 1em;
247
285
  background: none;
248
286
  color: inherit;
249
- font-family: 'Fira Mono','Consolas',monospace;
250
- font-size: .95em;
287
+ font-family: 'Fira Mono', 'Consolas', monospace;
288
+ font-size: 0.95em;
251
289
  }
252
290
 
253
291
  .code-toolbar {
@@ -257,24 +295,30 @@ table.sortable th.sorted-desc::after {
257
295
  z-index: 2;
258
296
  }
259
297
 
260
- .copy-btn, .view-raw-btn {
298
+ .copy-btn,
299
+ .view-raw-btn {
261
300
  color: #fff;
262
301
  background: #444;
263
302
  border-radius: 4px;
264
303
  padding: 2px 8px;
265
- font-size: .85em;
304
+ font-size: 0.85em;
266
305
  text-decoration: none;
267
306
  margin-left: 4px;
268
307
  cursor: pointer;
269
308
  transition: background 0.2s;
270
309
  }
271
310
 
272
- .copy-btn:hover, .view-raw-btn:hover {
311
+ .copy-btn:hover,
312
+ .view-raw-btn:hover {
273
313
  background: #1abc9c;
274
314
  }
275
315
 
276
- /* Table Wrapper */
277
316
  .table-wrapper {
278
317
  overflow-x: auto;
279
318
  width: 100%;
280
319
  }
320
+
321
+ table, .syntax-block, pre {
322
+ max-width: 100%;
323
+ overflow-x: auto;
324
+ }
staticdash/dashboard.py CHANGED
@@ -2,6 +2,7 @@ import os
2
2
  import shutil
3
3
  import uuid
4
4
  import pandas as pd
5
+ import plotly.graph_objects as go
5
6
  from dominate import document
6
7
  from dominate.tags import div, h1, h2, h3, h4, p, a, script, link
7
8
  from dominate.util import raw as raw_util
@@ -160,6 +161,7 @@ class Dashboard:
160
161
  os.makedirs(downloads_dir, exist_ok=True)
161
162
  shutil.copytree(assets_src, assets_dst, dirs_exist_ok=True)
162
163
 
164
+ # Per-page HTML
163
165
  for page in self.pages:
164
166
  doc = document(title=page.title)
165
167
  with doc.head:
@@ -171,23 +173,13 @@ class Dashboard:
171
173
  doc.head.add(script(src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-python.min.js"))
172
174
  doc.head.add(script(src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-javascript.min.js"))
173
175
  with doc:
174
- with div(id="sidebar"):
175
- h1(self.title)
176
- with div(cls="nav-links"):
177
- for p in self.pages:
178
- a(p.title, cls="nav-link", href="#", **{"data-target": f"page-{p.slug}"})
179
- with div(id="sidebar-footer"):
180
- a("Produced by staticdash", href="https://pypi.org/project/staticdash/", target="_blank")
181
- with div(id="wrapper"):
182
- with div(id="wrapper-inner"):
183
- with div(id="content"):
184
- for idx, p in enumerate(self.pages):
185
- with div(id=f"page-{p.slug}", cls="page-section", style="display:none;") as section:
186
- for el in p.render(idx, downloads_dir=downloads_dir, relative_prefix=""):
187
- section += el
176
+ with div(cls="page-section", id=f"page-{page.slug}") as section:
177
+ for el in page.render(0, downloads_dir=downloads_dir, relative_prefix="../"):
178
+ section += el
188
179
  with open(os.path.join(pages_dir, f"{page.slug}.html"), "w") as f:
189
180
  f.write(str(doc))
190
181
 
182
+ # Main index.html
191
183
  index_doc = document(title=self.title)
192
184
  with index_doc.head:
193
185
  index_doc.head.add(link(rel="stylesheet", href="assets/css/style.css"))
@@ -201,19 +193,17 @@ class Dashboard:
201
193
  with index_doc:
202
194
  with div(id="sidebar"):
203
195
  h1(self.title)
204
- with div(cls="nav-links"):
205
- for page in self.pages:
206
- a(page.title, cls="nav-link", href="#", **{"data-target": f"page-{page.slug}"})
196
+ for page in self.pages:
197
+ a(page.title, cls="nav-link", href="#", **{"data-target": f"page-{page.slug}"})
207
198
  with div(id="sidebar-footer"):
208
199
  a("Produced by staticdash", href="https://pypi.org/project/staticdash/", target="_blank")
209
200
 
210
- with div(id="wrapper"):
211
- with div(id="wrapper-inner"):
212
- with div(id="content"):
213
- for idx, page in enumerate(self.pages):
214
- with div(id=f"page-{page.slug}", cls="page-section", style="display:none;") as section:
215
- for el in page.render(idx, downloads_dir=downloads_dir, relative_prefix=""):
216
- section += el
201
+ with div(id="content"):
202
+ with div(cls="content-inner"):
203
+ for idx, page in enumerate(self.pages):
204
+ with div(id=f"page-{page.slug}", cls="page-section", style="display:none;") as section:
205
+ for el in page.render(idx, downloads_dir=downloads_dir, relative_prefix=""):
206
+ section += el
217
207
 
218
208
  with open(os.path.join(output_dir, "index.html"), "w") as f:
219
- f.write(str(index_doc))
209
+ f.write(str(index_doc))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staticdash
3
- Version: 0.4.1
3
+ Version: 0.4.2
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
@@ -0,0 +1,8 @@
1
+ staticdash/__init__.py,sha256=KqViaDkiQnhBI8-j3hr14umLDmPgddvdB_G1nJeC5Xs,38
2
+ staticdash/dashboard.py,sha256=wfFJ6XPSs711jUSWPkHzRxsAU02g7zzyA9rkIiWfbwA,9844
3
+ staticdash/assets/css/style.css,sha256=mT-WK5zr3AoKENSrqYqL65pposLhbHKeuri8Xr6IjRo,4928
4
+ staticdash/assets/js/script.js,sha256=pXqvTyw1LRNYl5u1kQbRtQkwe0dnd1yDs1Jstj7S-GU,4148
5
+ staticdash-0.4.2.dist-info/METADATA,sha256=F0_mWymbExiHFnQJb69x8fJsqYp2r1vvtV07rkzJKdg,1776
6
+ staticdash-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ staticdash-0.4.2.dist-info/top_level.txt,sha256=3MzZU6SptkUkjcHV1cvPji0H4aRzPphLHnpStgGEcxM,11
8
+ staticdash-0.4.2.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- staticdash/__init__.py,sha256=KqViaDkiQnhBI8-j3hr14umLDmPgddvdB_G1nJeC5Xs,38
2
- staticdash/dashboard.py,sha256=5CWNHWFRgE0-DRQCnsxtmTigMN_Q2MuTGVGj03eUMXk,10572
3
- staticdash/assets/css/style.css,sha256=wdTyRpTTYZtNOdb3NygdKYN6UEAKDwOoRx3-zyfphPQ,4232
4
- staticdash/assets/js/script.js,sha256=pXqvTyw1LRNYl5u1kQbRtQkwe0dnd1yDs1Jstj7S-GU,4148
5
- staticdash-0.4.1.dist-info/METADATA,sha256=Kw6f3V-VAbEFOlrx7Ea0IdCFA6V2fwv9MZgpIXF5uHU,1776
6
- staticdash-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- staticdash-0.4.1.dist-info/top_level.txt,sha256=3MzZU6SptkUkjcHV1cvPji0H4aRzPphLHnpStgGEcxM,11
8
- staticdash-0.4.1.dist-info/RECORD,,