Skip to content

Commit c81c1fb

Browse files
committed
improve wasm index file
1 parent cee4074 commit c81c1fb

File tree

1 file changed

+77
-70
lines changed

1 file changed

+77
-70
lines changed

wasm-preview/index.html

Lines changed: 77 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,81 @@
11
<!DOCTYPE html>
2-
<title>pydantic-core unit tests</title>
3-
<style>
4-
html, body {
5-
height: 100%;
6-
background: rgb(30, 31, 46);
7-
color: white;
8-
font-family: monospace;
9-
overflow: hidden;
10-
}
11-
main {
12-
max-width: 800px;
13-
height: 100%;
14-
margin: 10px auto;
15-
}
16-
section {
17-
margin-top: 20px;
18-
padding: 10px 15px;
19-
height: calc(100% - 160px);
20-
overflow-y: scroll;
21-
overflow-x: hidden;
22-
border: 1px solid #aaa;
23-
border-radius: 5px;
24-
}
25-
pre {
26-
margin: 0;
27-
padding: 0;
28-
white-space: pre-wrap;
29-
}
30-
a {
31-
color: #58a6ff;
32-
text-decoration: none;
33-
}
34-
</style>
35-
<main>
36-
<h1>
37-
<a href="https://github.com/samuelcolvin/pydantic-core/tree/main/wasm-preview">pydantic-core</a> v<span id="version">0.1.0</span> unit tests
38-
</h1>
39-
<aside>
40-
pydantic-core is compiled to webassembly and run in the browser using
41-
<a href="https://pyodide.org/en/stable/">pyodide</a>.
42-
</aside>
43-
<section>
44-
<pre id="output">loading...</pre>
45-
</section>
46-
</main>
2+
<!-- NOTE: to view this page go to: https://githubproxy.samuelcolvin.workers.dev/samuelcolvin/pydantic-core/blob/main/wasm-preview/index.html -->
3+
<html lang="en">
4+
<head>
5+
<title>pydantic-core unit tests</title>
6+
<style>
7+
html, body {
8+
height: 100%;
9+
background: rgb(30, 31, 46);
10+
color: white;
11+
font-family: monospace;
12+
overflow: hidden;
13+
}
14+
main {
15+
max-width: 800px;
16+
height: 100%;
17+
margin: 10px auto;
18+
}
19+
section {
20+
margin-top: 20px;
21+
padding: 10px 15px;
22+
height: calc(100% - 160px);
23+
overflow-y: scroll;
24+
overflow-x: hidden;
25+
border: 1px solid #aaa;
26+
border-radius: 5px;
27+
}
28+
pre {
29+
margin: 0;
30+
padding: 0;
31+
white-space: pre-wrap;
32+
}
33+
a {
34+
color: #58a6ff;
35+
text-decoration: none;
36+
}
37+
</style>
38+
</head>
39+
<body>
40+
<main>
41+
<h1>
42+
<a href="https://github.com/samuelcolvin/pydantic-core/tree/main/wasm-preview">pydantic-core</a> v<span id="version">0.1.0</span> unit tests
43+
</h1>
44+
<aside>
45+
pydantic-core is compiled to webassembly and run in the browser using
46+
<a href="https://pyodide.org/en/stable/">pyodide</a>.
47+
</aside>
48+
<section>
49+
<pre id="output">loading...</pre>
50+
</section>
51+
</main>
4752

48-
<script src="https://smokeshow.helpmanual.io/2d1p666q3x5f0j26223o/ansi-to-html.browser.js"></script>
49-
<script>
50-
const output_el = document.getElementById('output')
51-
const decoder = new TextDecoder()
52-
const Convert = require('ansi-to-html')
53-
const ansi_converter = new Convert()
54-
let terminal_output = ''
55-
const version = document.getElementById('version').textContent
53+
<script src="https://smokeshow.helpmanual.io/2d1p666q3x5f0j26223o/ansi-to-html.browser.js"></script>
54+
<script>
55+
const output_el = document.getElementById('output')
56+
const decoder = new TextDecoder()
57+
const Convert = require('ansi-to-html')
58+
const ansi_converter = new Convert()
59+
let terminal_output = ''
60+
const version = document.getElementById('version').textContent
5661

57-
output_el.innerText = 'Starting worker...'
58-
const worker = new Worker(`./worker.js?v=${Date.now()}`)
59-
worker.onmessage = ({data}) => {
60-
if (typeof data == 'string') {
61-
terminal_output += data
62-
} else {
63-
for (let chunk of data) {
64-
let arr = new Uint8Array(chunk)
65-
let extra = decoder.decode(arr)
66-
terminal_output += extra
62+
output_el.innerText = 'Starting worker...'
63+
const worker = new Worker(`./worker.js?v=${Date.now()}`)
64+
worker.onmessage = ({data}) => {
65+
if (typeof data == 'string') {
66+
terminal_output += data
67+
} else {
68+
for (let chunk of data) {
69+
let arr = new Uint8Array(chunk)
70+
let extra = decoder.decode(arr)
71+
terminal_output += extra
72+
}
73+
}
74+
output_el.innerHTML = ansi_converter.toHtml(terminal_output)
75+
// scrolls to the bottom of the div
76+
output_el.scrollIntoView(false)
6777
}
68-
}
69-
output_el.innerHTML = ansi_converter.toHtml(terminal_output)
70-
// scrolls to the bottom of the div
71-
output_el.scrollIntoView(false)
72-
}
73-
worker.postMessage({version})
74-
</script>
78+
worker.postMessage({version})
79+
</script>
80+
</body>
81+
</html>

0 commit comments

Comments
 (0)