|
| 1 | +import ilha, { html } from "ilha"; |
| 2 | + |
| 3 | +export default ilha |
| 4 | + .state("count", 0) |
| 5 | + .on("[data-action=increase]@click", ({ state }) => { |
| 6 | + state.count(state.count() + 1); |
| 7 | + }) |
| 8 | + .on("[data-action=reset]@click", ({ state }) => { |
| 9 | + state.count(0); |
| 10 | + }) |
| 11 | + .render( |
| 12 | + ({ state }) => html` |
| 13 | + <main> |
| 14 | + <div class="container"> |
| 15 | + <h1>Ilha + Electrobun</h1> |
| 16 | + <p class="subtitle">A fast desktop app with hot module replacement — no framework needed</p> |
| 17 | +
|
| 18 | + <div class="card"> |
| 19 | + <h2>Interactive Counter</h2> |
| 20 | + <p> |
| 21 | + Click the button below to test vanilla TypeScript. With HMR enabled, |
| 22 | + you can edit this file and see changes instantly. |
| 23 | + </p> |
| 24 | + <div class="button-group"> |
| 25 | + <button class="primary" data-action="increase"> |
| 26 | + Count: ${state.count()} |
| 27 | + </button> |
| 28 | + <button class="secondary" data-action="reset"> |
| 29 | + Reset |
| 30 | + </button> |
| 31 | + </div> |
| 32 | + </div> |
| 33 | +
|
| 34 | + <div class="card"> |
| 35 | + <h2>Getting Started</h2> |
| 36 | + <ul> |
| 37 | + <li> |
| 38 | + <span class="number">1.</span> |
| 39 | + Run <code>bun run dev</code> for development without HMR |
| 40 | + </li> |
| 41 | + <li> |
| 42 | + <span class="number">2.</span> |
| 43 | + Run <code>bun run dev:hmr</code> for development with hot reload |
| 44 | + </li> |
| 45 | + <li> |
| 46 | + <span class="number">3.</span> |
| 47 | + Run <code>bun run build</code> to build for production |
| 48 | + </li> |
| 49 | + </ul> |
| 50 | + </div> |
| 51 | +
|
| 52 | + <div class="card"> |
| 53 | + <h2>Stack</h2> |
| 54 | + <div class="stack-grid"> |
| 55 | + <div class="stack-item"> |
| 56 | + <span class="icon">⚡</span> |
| 57 | + <span>Electrobun</span> |
| 58 | + </div> |
| 59 | + <div class="stack-item"> |
| 60 | + <span class="icon">🟦</span> |
| 61 | + <span>TypeScript</span> |
| 62 | + </div> |
| 63 | + <div class="stack-item"> |
| 64 | + <span class="icon">🔥</span> |
| 65 | + <span>Vite HMR</span> |
| 66 | + </div> |
| 67 | + <div class="stack-item"> |
| 68 | + <span class="icon">📦</span> |
| 69 | + <span>Bun</span> |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | +
|
| 74 | + <div class="footer"> |
| 75 | + <p> |
| 76 | + Edit <code>src/mainview/main.ts</code> and save to see HMR in action |
| 77 | + </p> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </main> |
| 81 | + `, |
| 82 | + ); |
0 commit comments