Skip to content

Commit

Permalink
host a gh page
Browse files Browse the repository at this point in the history
  • Loading branch information
x86y committed Oct 1, 2023
1 parent 7266781 commit 9e05853
Show file tree
Hide file tree
Showing 12 changed files with 744 additions and 177 deletions.
79 changes: 79 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ version = "0.1.0"
edition = "2021"

[lib]
name = "franca"
name = "lib"
crate-type = ["cdylib"]
path = "src/lib.rs"

[[bin]]
name = "franca-transform"
path = "src/bin.rs"
name = "bin"
path = "src/main.rs"

[dependencies]
quote = "1.0.33"
syn = { version = "2.0.37", features = ["full"] }
wasm-bindgen = "0.2.87"
90 changes: 90 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<link href="https://pvinis.github.io/iosevka-webfont/3.4.1/iosevka.css" rel="stylesheet" />
<title>Franca</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
#wasmForm {
background-color: #ffffff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 500px;
box-sizing: border-box;
}
textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-family: 'Courier New', monospace;
resize: vertical;
height: 150px;
margin-bottom: 15px;
font-family: "Iosevka Web";
}
button {
background-color: #007BFF;
color: #ffffff;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
pre {
font-family: "Iosevka Web";
background-color: #e8e8e8;
padding: 10px;
border-radius: 4px;
margin-top: 15px;
font-size: 14px;
white-space: pre-wrap; /* Since CSS 2.1 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
</style>
</head>
<body>
<form id="wasmForm">
<textarea id="inputVal" placeholder="Write rust code here">
fn main() {
for i in 0..5 {
println!("For loop");
}
loop {
println!("Forever loop");
}
}
</textarea>
<button type="submit">Enter</button>
<pre><div id="output"></div></pre>
</form>

<script type="module">
import init, { terser_loops } from "./pkg/lib.js";

init();

document.getElementById('wasmForm').addEventListener('submit', function(e) {
e.preventDefault();
const inputValue = document.getElementById('inputVal').value;
const result = terser_loops(inputValue);
document.getElementById('output').textContent = result;
});
</script>
</body>
</html>

1 change: 1 addition & 0 deletions pkg/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
39 changes: 39 additions & 0 deletions pkg/lib.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* tslint:disable */
/* eslint-disable */
/**
* @param {string} i
* @returns {string}
*/
export function terser_loops(i: string): string;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly terser_loops: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading

0 comments on commit 9e05853

Please sign in to comment.