| 1 | <script lang="ts"> |
| 2 | import { invoke } from "@tauri-apps/api/core"; |
| 3 | |
| 4 | let name = $state(""); |
| 5 | let greetMsg = $state(""); |
| 6 | |
| 7 | async function greet(event: Event) { |
| 8 | event.preventDefault(); |
| 9 | // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ |
| 10 | greetMsg = await invoke("greet", { name }); |
| 11 | } |
| 12 | </script> |
| 13 | |
| 14 | <main class="container"> |
| 15 | <h1>Welcome to Tauri + Svelte</h1> |
| 16 | |
| 17 | <div class="row"> |
| 18 | <a href="https://vite.dev" target="_blank"> |
| 19 | <img src="/vite.svg" class="logo vite" alt="Vite Logo" /> |
| 20 | </a> |
| 21 | <a href="https://tauri.app" target="_blank"> |
| 22 | <img src="/tauri.svg" class="logo tauri" alt="Tauri Logo" /> |
| 23 | </a> |
| 24 | <a href="https://svelte.dev" target="_blank"> |
| 25 | <img src="/svelte.svg" class="logo svelte-kit" alt="SvelteKit Logo" /> |
| 26 | </a> |
| 27 | </div> |
| 28 | <p>Click on the Tauri, Vite, and SvelteKit logos to learn more.</p> |
| 29 | |
| 30 | <form class="row" onsubmit={greet}> |
| 31 | <input id="greet-input" placeholder="Enter a name..." bind:value={name} /> |
| 32 | <button type="submit">Greet</button> |
| 33 | </form> |
| 34 | <p>{greetMsg}</p> |
| 35 | </main> |
| 36 | |
| 37 | <style> |
| 38 | .logo.vite:hover { |
| 39 | filter: drop-shadow(0 0 2em #747bff); |
| 40 | } |
| 41 | |
| 42 | .logo.svelte-kit:hover { |
| 43 | filter: drop-shadow(0 0 2em #ff3e00); |
| 44 | } |
| 45 | |
| 46 | :root { |
| 47 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif; |
| 48 | font-size: 16px; |
| 49 | line-height: 24px; |
| 50 | font-weight: 400; |
| 51 | |
| 52 | color: #0f0f0f; |
| 53 | background-color: #f6f6f6; |
| 54 | |
| 55 | font-synthesis: none; |
| 56 | text-rendering: optimizeLegibility; |
| 57 | -webkit-font-smoothing: antialiased; |
| 58 | -moz-osx-font-smoothing: grayscale; |
| 59 | -webkit-text-size-adjust: 100%; |
| 60 | } |
| 61 | |
| 62 | .container { |
| 63 | margin: 0; |
| 64 | padding-top: 10vh; |
| 65 | display: flex; |
| 66 | flex-direction: column; |
| 67 | justify-content: center; |
| 68 | text-align: center; |
| 69 | } |
| 70 | |
| 71 | .logo { |
| 72 | height: 6em; |
| 73 | padding: 1.5em; |
| 74 | will-change: filter; |
| 75 | transition: 0.75s; |
| 76 | } |
| 77 | |
| 78 | .logo.tauri:hover { |
| 79 | filter: drop-shadow(0 0 2em #24c8db); |
| 80 | } |
| 81 | |
| 82 | .row { |
| 83 | display: flex; |
| 84 | justify-content: center; |
| 85 | } |
| 86 | |
| 87 | a { |
| 88 | font-weight: 500; |
| 89 | color: #646cff; |
| 90 | text-decoration: inherit; |
| 91 | } |
| 92 | |
| 93 | a:hover { |
| 94 | color: #535bf2; |
| 95 | } |
| 96 | |
| 97 | h1 { |
| 98 | text-align: center; |
| 99 | } |
| 100 | |
| 101 | input, |
| 102 | button { |
| 103 | border-radius: 8px; |
| 104 | border: 1px solid transparent; |
| 105 | padding: 0.6em 1.2em; |
| 106 | font-size: 1em; |
| 107 | font-weight: 500; |
| 108 | font-family: inherit; |
| 109 | color: #0f0f0f; |
| 110 | background-color: #ffffff; |
| 111 | transition: border-color 0.25s; |
| 112 | box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); |
| 113 | } |
| 114 | |
| 115 | button { |
| 116 | cursor: pointer; |
| 117 | } |
| 118 | |
| 119 | button:hover { |
| 120 | border-color: #396cd8; |
| 121 | } |
| 122 | button:active { |
| 123 | border-color: #396cd8; |
| 124 | background-color: #e8e8e8; |
| 125 | } |
| 126 | |
| 127 | input, |
| 128 | button { |
| 129 | outline: none; |
| 130 | } |
| 131 | |
| 132 | #greet-input { |
| 133 | margin-right: 5px; |
| 134 | } |
| 135 | |
| 136 | @media (prefers-color-scheme: dark) { |
| 137 | :root { |
| 138 | color: #f6f6f6; |
| 139 | background-color: #2f2f2f; |
| 140 | } |
| 141 | |
| 142 | a:hover { |
| 143 | color: #24c8db; |
| 144 | } |
| 145 | |
| 146 | input, |
| 147 | button { |
| 148 | color: #ffffff; |
| 149 | background-color: #0f0f0f98; |
| 150 | } |
| 151 | button:active { |
| 152 | background-color: #0f0f0f69; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | </style> |