Files
zed/crates/gpui_web/examples/hello_web/index.html
T
Lukas Wirth 2c2f737ab2 gpui: Add sendable foreground execution for web HTTP clients (#66165)
## Summary

This cleans up the gpui_platform code a bit, and in combination the way
we set up the http client for the web. This does introduce a
`ForegroundExecutor` variant that it itself is Send-able, allowing to
dispatch foreground futures from background workers (by requiring the
future to be Send, unlike `ForegroundExecutor`), which is a requirement
for web fetch.

a31c7b54c60738b82524e4e4c12aec2f6caf101d fixes a bunch of warnings with
our binary names

Release Notes:

- [gpui] N/A
2026-10-29 09:12:10 +00:00

115 lines
5.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0" />
<title>GPUI Web Examples</title>
<link data-trunk rel="rust" data-bin="hello-web" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<!-- Trunk's worker pipelines build auxiliary modules without starting them.
The gallery imports these on the main thread, not in Web Workers. -->
<link data-trunk rel="rust" data-type="worker" data-bin="hello-world" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="text" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="text-layout" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="text-wrapper" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="input" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<script data-trunk type="module" src="gallery.js"></script>
<link data-trunk rel="rust" data-type="worker" data-bin="dynamic-fonts" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="font-fallback-test" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="queue-test" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<link data-trunk rel="rust" data-type="worker" data-bin="http-client-test" data-bindgen-target="web" data-keep-debug data-wasm-opt="0" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
margin: 0;
height: 100%;
}
body {
font-family: system-ui, sans-serif;
color: #202030;
background: #f5f5f8;
}
main {
max-width: 48rem;
margin: 0 auto;
padding: 3rem 1.5rem;
}
h1, main > p {
margin-bottom: 1.5rem;
}
ul {
list-style: none;
display: grid;
gap: 0.75rem;
}
li a {
display: block;
padding: 1rem;
border: 1px solid #d0d0dc;
border-radius: 0.5rem;
color: inherit;
background: white;
text-decoration: none;
}
li a:hover, li a:focus-visible {
border-color: #5050a0;
}
li span {
display: block;
margin-top: 0.25rem;
color: #555566;
}
#back {
position: fixed;
right: 0.75rem;
bottom: 0.75rem;
z-index: 1;
padding: 0.5rem 0.75rem;
border-radius: 0.25rem;
color: #202030;
background: #ffffffee;
}
#status {
position: fixed;
top: 1rem;
left: 1rem;
right: 1rem;
z-index: 1;
padding: 1rem;
background: white;
white-space: pre-wrap;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
-webkit-user-select: none;
user-select: none;
}
</style>
</head>
<body>
<main id="gallery">
<h1>GPUI Web Examples</h1>
<p>Each example runs in its own WebAssembly instance. Choose an example to open it.</p>
<ul>
<li><a href="/hello-world" data-module="hello-world"><strong>Hello world</strong><span>Basic GPUI layout and styling.</span></a></li>
<li><a href="/text" data-module="text"><strong>Styled text</strong><span>Typography, font sizes, and line heights.</span></a></li>
<li><a href="/text-layout" data-module="text-layout"><strong>Text layout</strong><span>Alignment, decorations, and font weights.</span></a></li>
<li><a href="/text-wrapper" data-module="text-wrapper"><strong>Text wrapping</strong><span>Wrapping and truncation, including CJK sample text.</span></a></li>
<li><a href="/input" data-module="input"><strong>Text input</strong><span>Typing, cursor movement, and selections.</span></a></li>
<li><a href="/dynamic-fonts" data-module="dynamic-fonts"><strong>Dynamic fonts</strong><span>Download a font when missing glyphs are reported.</span></a></li>
<li><a href="/prime-sieve" data-module="hello-web"><strong>Prime sieve</strong><span>Background tasks and progress updates.</span></a></li>
</ul>
</main>
<a id="back" href="/" hidden>All examples</a>
<p id="status" role="status" hidden></p>
</body>
</html>