-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-table.html
More file actions
150 lines (130 loc) · 3.64 KB
/
Copy pathdata-table.html
File metadata and controls
150 lines (130 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Friendly Error Messages - Demo Data</title>
<link rel="stylesheet" href="styles.css">
<style>
.demo-data__toolbar {
margin: 1rem 0 1.5rem;
display: flex;
gap: 0.75rem;
align-items: center;
flex-wrap: wrap;
}
.demo-data__toolbar a {
color: #1565c0;
text-decoration: underline;
text-underline-offset: 2px;
}
.demo-data__count {
color: #5f6c7b;
font-size: 0.95rem;
}
.demo-data__table-wrap {
overflow-x: auto;
background: #fff;
border-radius: 0.5rem;
box-shadow: 0 0.5rem 0.5rem rgba(0, 0, 0, 0.1);
}
.demo-data__table {
width: 100%;
border-collapse: collapse;
min-width: 56rem;
}
.demo-data__table th,
.demo-data__table td {
text-align: left;
vertical-align: top;
padding: 0.75rem;
border-bottom: 1px solid #e9ecef;
}
.demo-data__table th {
background: #f8f9fa;
color: #2c3e50;
font-size: 0.9rem;
letter-spacing: 0.01em;
}
.demo-data__table tr:last-child td {
border-bottom: 0;
}
.demo-data__mono {
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
font-size: 0.8rem;
white-space: pre-wrap;
word-break: break-word;
line-height: 1.45;
}
.demo-data__runtime {
display: inline-block;
border-radius: 999px;
padding: 0.2rem 0.5rem;
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
}
.demo-data__runtime--skulpt {
background: #e8f5e9;
color: #2e7d32;
}
.demo-data__runtime--pyodide {
background: #e3f2fd;
color: #1565c0;
}
</style>
</head>
<body>
<div class="container">
<h1>Demo Data Table</h1>
<div class="demo-data__toolbar">
<a href="index.html">Open demo view</a>
<span class="demo-data__count" id="row-count">Loading rows...</span>
</div>
<div class="demo-data__table-wrap">
<table class="demo-data__table" id="data-table">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Runtime</th>
<th>Code</th>
<th>Trace</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="5">Loading data...</td>
</tr>
</tbody>
</table>
</div>
</div>
<script type="module">
import { examples } from './demo-examples.js';
import { PYODIDE_VERSION } from './pyodide-config.js';
const tableBody = document.querySelector('#data-table tbody');
const rowCount = document.querySelector('#row-count');
// Traces are cached from real Pyodide output (npm run regen:traces). The live demo (index.html) regenerates them in-browser against the same pinned version
rowCount.textContent = `${examples.length} rows · traces cached from Pyodide v${PYODIDE_VERSION}`;
tableBody.innerHTML = examples.map((example, index) => `
<tr>
<td>${index + 1}</td>
<td>${escapeHtml(example.title)}</td>
<td>
<span class="demo-data__runtime demo-data__runtime--pyodide">
pyodide
</span>
</td>
<td><div class="demo-data__mono">${escapeHtml(example.code)}</div></td>
<td><div class="demo-data__mono">${escapeHtml(example.trace)}</div></td>
</tr>
`).join('');
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
</script>
</body>
</html>