-
-
Notifications
You must be signed in to change notification settings - Fork 10
Make layout split vertical. Add xterm.js for output. Add examples selection. #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
de80e64
9b249a2
4abac1a
406ba04
3944979
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,22 +9,38 @@ | |||||
| <link rel="stylesheet" href="style/style.css"> | ||||||
| </head> | ||||||
| <body> | ||||||
| <button id="run">Run</button> | ||||||
| <header> | ||||||
| <div class="header-info"> | ||||||
| <h1><a href="https://playground.zigtools.org">playground</a></h1> | ||||||
| <span>|</span> | ||||||
| <span>A <a href="https://zigtools.org">zigtools</a> initiative.</span> | ||||||
| <span>|</span> | ||||||
| <span><span id="warning">Warning</span> Zig's self-hosted WebAssembly backend is still experimental!</span> | ||||||
| </div> | ||||||
| <div class="header-controls"> | ||||||
| <select id="example-select"> | ||||||
| <option value="hello-world">Hello World</option> | ||||||
| <option value="ansi-text">ANSI Text</option> | ||||||
| <option value="fizz-buzz">FizzBuzz</option> | ||||||
| <option value="fibonacci">Fibonacci</option> | ||||||
| <option value="mandelbrot">Mandelbrot</option> | ||||||
| <option value="kitty-image">Kitty Image</option> | ||||||
| </select> | ||||||
| <button id="run">Run</button> | ||||||
| </div> | ||||||
| </header> | ||||||
|
|
||||||
| <main> | ||||||
| <div id="split-pane" style="--editor-height-percent: 100%;"> | ||||||
| <div id="split-pane" style="--editor-width-percent: 60%;"> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The terminal panel should remain closed because it serves little purpose until the run button has been pressed. Until the terminal has any content to display, the user might not even understand what the right side of the page is supposed to be. In the future, this would also allow the terminal to be initialized lazily after the initial page load. |
||||||
| <div id="editor"></div> | ||||||
| <div id="resize-bar"></div> | ||||||
| <div id="output"></div> | ||||||
| <div id="output-pane"> | ||||||
| <div id="execution-status"> </div> | ||||||
| <div id="output"></div> | ||||||
| </div> | ||||||
| </div> | ||||||
| </main> | ||||||
|
|
||||||
| <footer> | ||||||
| <h1><a href="https://playground.zigtools.org">playground</a></h1> | ||||||
| <span><span id="warning">Warning</span> Zig's self-hosted WebAssembly backend is still experimental!</span> | ||||||
| <span>A <a href="https://zigtools.org">zigtools</a> initiative.</span> | ||||||
| </footer> | ||||||
|
|
||||||
| <script src="/src/editor.ts" type="module"></script> | ||||||
| </body> | ||||||
| </html> | ||||||
| </html> | ||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| const std = @import("std"); | ||
|
|
||
| pub fn main(init: std.process.Init) !void { | ||
| var buffer: [4096]u8 = undefined; | ||
| var file_writer = std.Io.File.stdout().writerStreaming(init.io, &buffer); | ||
| const stdout = &file_writer.interface; | ||
|
|
||
| try stdout.writeAll("\x1b[31mred\n"); | ||
| try stdout.writeAll("\x1b[32mgreen\n"); | ||
| try stdout.writeAll("\x1b[33myellow\n"); | ||
| try stdout.writeAll("\x1b[34mblue\n"); | ||
| try stdout.writeAll("\x1b[35mmagenta\n"); | ||
| try stdout.writeAll("\x1b[36mcyan\n"); | ||
| try stdout.writeAll("\x1b[37mwhite\n"); | ||
| try stdout.writeAll("\x1b[0mreset\n"); | ||
| try stdout.flush(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| const std = @import("std"); | ||
|
|
||
| pub fn main(init: std.process.Init) !void { | ||
| var buffer: [4096]u8 = undefined; | ||
| var file_writer = std.Io.File.stdout().writerStreaming(init.io, &buffer); | ||
| const stdout = &file_writer.interface; | ||
|
|
||
| var a: u32 = 0; | ||
| var b: u32 = 1; | ||
|
|
||
| for (0..12) |_| { | ||
| try stdout.print("{d}\n", .{a}); | ||
| const c = a + b; | ||
| a = b; | ||
| b = c; | ||
| } | ||
|
|
||
| try stdout.flush(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| const std = @import("std"); | ||
|
|
||
| pub fn main(init: std.process.Init) !void { | ||
| var buffer: [4096]u8 = undefined; | ||
| var file_writer = std.Io.File.stdout().writerStreaming(init.io, &buffer); | ||
| const stdout = &file_writer.interface; | ||
|
|
||
| for (1..21) |number| { | ||
| if (number % 15 == 0) { | ||
| try stdout.writeAll("FizzBuzz\n"); | ||
| } else if (number % 3 == 0) { | ||
| try stdout.writeAll("Fizz\n"); | ||
| } else if (number % 5 == 0) { | ||
| try stdout.writeAll("Buzz\n"); | ||
| } else { | ||
| try stdout.print("{d}\n", .{number}); | ||
| } | ||
| } | ||
|
|
||
| try stdout.flush(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will show a "Select Example" placeholder instead of "Hello World". This is better at explaining the purpose of that dropdown. When persistence between browser sessions is implemented, showing "Hello World" is going to be especially confusing.
The autocomplete property prevents the selection from being remembered between sessions.