| 1 |
<!doctype html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<title>wasm-tools print</title> |
| 6 |
<script type="module" src="print.js"></script> |
| 7 |
<link rel="stylesheet" href="style.css"> |
| 8 |
<style> |
| 9 |
.textarea-container { |
| 10 |
flex-grow: 1; |
| 11 |
padding: .4rem; |
| 12 |
display: grid; |
| 13 |
grid-column-gap: calc(.8rem + 8px);; |
| 14 |
grid-template-rows: min-content auto 1fr; |
| 15 |
grid-template-areas: |
| 16 |
"h" |
| 17 |
"a" |
| 18 |
"o" |
| 19 |
} |
| 20 |
|
| 21 |
button { |
| 22 |
font-size: inherit; |
| 23 |
} |
| 24 |
|
| 25 |
.config { |
| 26 |
float: right; |
| 27 |
} |
| 28 |
|
| 29 |
.description { |
| 30 |
grid-area: h; |
| 31 |
} |
| 32 |
|
| 33 |
.output-header { |
| 34 |
grid-area: a; |
| 35 |
padding-bottom: .4rem; |
| 36 |
} |
| 37 |
|
| 38 |
.output-container { |
| 39 |
grid-area: o; |
| 40 |
overflow-x: scroll; |
| 41 |
} |
| 42 |
|
| 43 |
#output { |
| 44 |
box-sizing: border-box; |
| 45 |
padding: .4rem; |
| 46 |
min-height: calc(100% - .4rem); |
| 47 |
width: 100%; |
| 48 |
margin: 0; |
| 49 |
border: 1px solid black; |
| 50 |
border-radius: 5px; |
| 51 |
overflow-x: scroll; |
| 52 |
} |
| 53 |
|
| 54 |
#overlay { |
| 55 |
position: fixed; |
| 56 |
top: 0; |
| 57 |
left: 0; |
| 58 |
width: 100%; |
| 59 |
height: 100%; |
| 60 |
background-color: rgba(0, 0, 0, .2); |
| 61 |
display: none; |
| 62 |
justify-content: center; |
| 63 |
align-items: center; |
| 64 |
text-shadow: 0 0 2px white; |
| 65 |
font-size: 24px; |
| 66 |
pointer-events: none; |
| 67 |
} |
| 68 |
|
| 69 |
.print-name { |
| 70 |
color: #9F00BD; |
| 71 |
} |
| 72 |
|
| 73 |
.print-literal { |
| 74 |
color: #FB0416; |
| 75 |
} |
| 76 |
|
| 77 |
.print-keyword { |
| 78 |
font-weight: bold; |
| 79 |
} |
| 80 |
|
| 81 |
.print-type { |
| 82 |
color: #328A5D; |
| 83 |
} |
| 84 |
|
| 85 |
.print-comment { |
| 86 |
color: #B3B3B3; |
| 87 |
} |
| 88 |
</style> |
| 89 |
</head> |
| 90 |
|
| 91 |
<header> |
| 92 |
<h1>wasm-tools print</h1> |
| 93 |
</header> |
| 94 |
|
| 95 |
<div id="overlay">Drop .wasm file here</div> |
| 96 |
|
| 97 |
<div class="textarea-container"> |
| 98 |
<div class="description"> |
| 99 |
<p>Translate WebAssembly binaries to text format using <a href="https://github.com/bytecodealliance/wasm-tools"><code>wasm-tools print</code></a>. |
| 100 |
You can go the other direction using <a href="parse"><code>parse</code></a>.</p> |
| 101 |
</div> |
| 102 |
|
| 103 |
<div class="output-header"> |
| 104 |
Drop a file on this page, or <button id="upload">manually select a file</button>. |
| 105 |
<input type="file" id="fileInput" accept=".wasm" style="display:none;"> |
| 106 |
<span class="config"> |
| 107 |
<input type="checkbox" id="skeleton"> |
| 108 |
<label for="skeleton">Skip function bodies (recommended for large files)</label> |
| 109 |
</span> |
| 110 |
</div> |
| 111 |
<div class="output-container"> |
| 112 |
<!-- adding contenteditable is the easiest way to let the user copy-paste the whole contents --> |
| 113 |
<pre id="output" class="iobox" contenteditable="plaintext-only" spellcheck="false"></pre> |
| 114 |
</div> |
| 115 |
</div> |