|
1 | 1 | <script lang="ts"> |
2 | | - import { invoke } from "@tauri-apps/api/core"; |
| 2 | + import {invoke} from "@tauri-apps/api/core"; |
| 3 | + import {pyInvoke} from "tauri-plugin-pytauri-api"; |
3 | 4 |
|
4 | | - let name = $state(""); |
5 | | - let greetMsg = $state(""); |
| 5 | + let name = $state(""); |
| 6 | + let greetMsg = $state(""); |
6 | 7 |
|
7 | | - async function greet(event: Event) { |
8 | | - event.preventDefault(); |
| 8 | + async function greet(event: Event) { |
| 9 | + event.preventDefault(); |
9 | 10 |
|
10 | | - // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ |
11 | | - const rsGreeting = await invoke<string>("greet", { |
12 | | - name: name.value, |
13 | | - }); |
14 | | - // Learn more about PyTauri commands at https://pytauri.github.io/pytauri/latest/usage/concepts/ipc/ |
15 | | - const pyGreeting = await pyInvoke<string>("greet", { |
16 | | - name: name.value, |
17 | | - }); |
18 | | - greetMsg = rsGreeting + "\n" + pyGreeting; |
| 11 | + // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ |
| 12 | + const rsGreeting = await invoke<string>("greet", { |
| 13 | + name: name, |
| 14 | + }); |
| 15 | + // Learn more about PyTauri commands at https://pytauri.github.io/pytauri/latest/usage/concepts/ipc/ |
| 16 | + const pyGreeting = await pyInvoke<string>("greet", { |
| 17 | + name: name, |
| 18 | + }); |
| 19 | + greetMsg = rsGreeting + "\n" + pyGreeting; |
19 | 20 |
|
20 | | - } |
| 21 | + } |
21 | 22 | </script> |
22 | 23 |
|
23 | 24 | <main class="container"> |
|
41 | 42 | </div> |
42 | 43 | <p>Click on any logo to learn more.</p> |
43 | 44 |
|
44 | | - <form class="row" onsubmit={greet}> |
45 | | - <input id="greet-input" placeholder="Enter a name..." bind:value={name} /> |
46 | | - <button type="submit">Greet</button> |
47 | | - </form> |
48 | | - <p id="greet-msg">{greetMsg}</p> |
| 45 | + <form class="row" onsubmit={greet}> |
| 46 | + <input id="greet-input" placeholder="Enter a name..." bind:value={name} /> |
| 47 | + <button type="submit">Greet</button> |
| 48 | + </form> |
| 49 | + <p id="greet-msg">{greetMsg}</p> |
49 | 50 | </main> |
50 | 51 |
|
51 | 52 | <style> |
52 | 53 |
|
53 | | -.logo.vite:hover { |
54 | | - filter: drop-shadow(0 0 2em #747bff); |
55 | | -} |
56 | | -
|
57 | | -.logo.python:hover { |
58 | | - filter: drop-shadow(0 0 2em #7b661b); |
59 | | -} |
60 | | -
|
61 | | -.logo.tauri:hover { |
62 | | - filter: drop-shadow(0 0 2em #24c8db); |
63 | | -} |
64 | | -
|
65 | | -.logo.pytauri:hover { |
66 | | - filter: drop-shadow(0 0 2em #2294b2); |
67 | | -} |
68 | | -
|
69 | | -.logo.svelte-kit:hover { |
70 | | - filter: drop-shadow(0 0 2em #ff3e00); |
71 | | -} |
72 | | -:root { |
73 | | - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; |
74 | | - font-size: 16px; |
75 | | - line-height: 24px; |
76 | | - font-weight: 400; |
77 | | -
|
78 | | - color: #0f0f0f; |
79 | | - background-color: #f6f6f6; |
80 | | -
|
81 | | - font-synthesis: none; |
82 | | - text-rendering: optimizeLegibility; |
83 | | - -webkit-font-smoothing: antialiased; |
84 | | - -moz-osx-font-smoothing: grayscale; |
85 | | - -webkit-text-size-adjust: 100%; |
86 | | -} |
87 | | -
|
88 | | -body { |
89 | | - margin: 0; |
90 | | -} |
91 | | -
|
92 | | -.container { |
93 | | - box-sizing: border-box; |
94 | | - padding: 8px; |
95 | | - height: 100vh; |
96 | | - gap: 1em; |
97 | | - display: flex; |
98 | | - flex-direction: column; |
99 | | - justify-content: center; |
100 | | - text-align: center; |
101 | | -} |
102 | | -
|
103 | | -.logo { |
104 | | - will-change: filter; |
105 | | - transition: 0.75s; |
106 | | -
|
107 | | - &:not(.pytauri) { |
108 | | - height: 3em; |
109 | | - } |
110 | | -
|
111 | | - &.pytauri { |
112 | | - height: 6em; |
113 | | - } |
114 | | -} |
115 | | -
|
116 | | -
|
117 | | -.row { |
118 | | - display: flex; |
119 | | - justify-content: center; |
120 | | -
|
121 | | - &:has(a) { |
122 | | - gap: 2em; |
123 | | - } |
124 | | -} |
125 | | -
|
126 | | -a { |
127 | | - font-weight: 500; |
128 | | - color: #646cff; |
129 | | - text-decoration: inherit; |
130 | | -} |
131 | | -
|
132 | | -a:hover { |
133 | | - color: #535bf2; |
134 | | -} |
135 | | -
|
136 | | -h1 { |
137 | | - text-align: center; |
138 | | -} |
139 | | -
|
140 | | -input, |
141 | | -button { |
142 | | - border-radius: 8px; |
143 | | - padding: 0.6em 1.2em; |
144 | | - font-size: 1em; |
145 | | - font-weight: 500; |
146 | | - font-family: inherit; |
147 | | - color: #0f0f0f; |
148 | | - box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); |
149 | | - outline: none; |
150 | | -} |
151 | | -
|
152 | | -input { |
153 | | - background-color: #ffffff; |
154 | | - border: 1px solid transparent; |
155 | | -} |
156 | | -
|
157 | | -button { |
158 | | - border-width: 0; |
159 | | - border-top: 2px solid color-mix(in oklab, white 50%, transparent); |
160 | | - background: linear-gradient(-45deg, #205f8a, #24c8db); |
161 | | - transition: opacity 0.5s ease; |
162 | | - color: white; |
163 | | -} |
164 | | -
|
165 | | -button { |
166 | | - cursor: pointer; |
167 | | -
|
168 | | - &:hover { |
169 | | - opacity: 70%; |
170 | | - } |
171 | | -
|
172 | | - &:active { |
173 | | - opacity: 30%; |
174 | | -
|
175 | | - } |
176 | | -} |
177 | | -#greet-input { |
178 | | - margin-right: 5px; |
179 | | -} |
180 | | -#greet-msg { |
181 | | - opacity: 50%; |
182 | | -} |
183 | | -
|
184 | | -@media (prefers-color-scheme: dark) { |
| 54 | + .logo.vite:hover { |
| 55 | + filter: drop-shadow(0 0 2em #747bff); |
| 56 | + } |
| 57 | +
|
| 58 | + .logo.python:hover { |
| 59 | + filter: drop-shadow(0 0 2em #7b661b); |
| 60 | + } |
| 61 | +
|
| 62 | + .logo.tauri:hover { |
| 63 | + filter: drop-shadow(0 0 2em #24c8db); |
| 64 | + } |
| 65 | +
|
| 66 | + .logo.pytauri:hover { |
| 67 | + filter: drop-shadow(0 0 2em #2294b2); |
| 68 | + } |
| 69 | +
|
| 70 | + .logo.svelte-kit:hover { |
| 71 | + filter: drop-shadow(0 0 2em #ff3e00); |
| 72 | + } |
185 | 73 | :root { |
186 | | - color: #f6f6f6; |
187 | | - background-color: #1b1b1f; |
| 74 | + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; |
| 75 | + font-size: 16px; |
| 76 | + line-height: 24px; |
| 77 | + font-weight: 400; |
| 78 | +
|
| 79 | + color: #0f0f0f; |
| 80 | + background-color: #f6f6f6; |
| 81 | +
|
| 82 | + font-synthesis: none; |
| 83 | + text-rendering: optimizeLegibility; |
| 84 | + -webkit-font-smoothing: antialiased; |
| 85 | + -moz-osx-font-smoothing: grayscale; |
| 86 | + -webkit-text-size-adjust: 100%; |
| 87 | + } |
| 88 | +
|
| 89 | + .container { |
| 90 | + box-sizing: border-box; |
| 91 | + padding: 8px; |
| 92 | + height: 100vh; |
| 93 | + gap: 1em; |
| 94 | + display: flex; |
| 95 | + flex-direction: column; |
| 96 | + justify-content: center; |
| 97 | + text-align: center; |
| 98 | + } |
| 99 | +
|
| 100 | + .logo { |
| 101 | + will-change: filter; |
| 102 | + transition: 0.75s; |
| 103 | +
|
| 104 | + &:not(.pytauri) { |
| 105 | + height: 3em; |
| 106 | + } |
| 107 | +
|
| 108 | + &.pytauri { |
| 109 | + height: 6em; |
| 110 | + } |
| 111 | + } |
| 112 | +
|
| 113 | +
|
| 114 | + .row { |
| 115 | + display: flex; |
| 116 | + justify-content: center; |
| 117 | +
|
| 118 | + &:has(a) { |
| 119 | + gap: 2em; |
| 120 | + } |
| 121 | + } |
| 122 | +
|
| 123 | + a { |
| 124 | + font-weight: 500; |
| 125 | + color: #646cff; |
| 126 | + text-decoration: inherit; |
| 127 | + } |
| 128 | +
|
| 129 | + a:hover { |
| 130 | + color: #535bf2; |
| 131 | + } |
| 132 | +
|
| 133 | + h1 { |
| 134 | + text-align: center; |
| 135 | + } |
| 136 | +
|
| 137 | + input, |
| 138 | + button { |
| 139 | + border-radius: 8px; |
| 140 | + padding: 0.6em 1.2em; |
| 141 | + font-size: 1em; |
| 142 | + font-weight: 500; |
| 143 | + font-family: inherit; |
| 144 | + color: #0f0f0f; |
| 145 | + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); |
| 146 | + outline: none; |
188 | 147 | } |
189 | 148 |
|
190 | 149 | input { |
191 | | - color: #ffffff; |
192 | | - background-color: #0f0f0f98; |
| 150 | + background-color: #ffffff; |
| 151 | + border: 1px solid transparent; |
| 152 | + } |
| 153 | +
|
| 154 | + button { |
| 155 | + border-width: 0; |
| 156 | + border-top: 2px solid color-mix(in oklab, white 50%, transparent); |
| 157 | + background: linear-gradient(-45deg, #205f8a, #24c8db); |
| 158 | + transition: opacity 0.5s ease; |
| 159 | + color: white; |
| 160 | + } |
| 161 | +
|
| 162 | + button { |
| 163 | + cursor: pointer; |
| 164 | +
|
| 165 | + &:hover { |
| 166 | + opacity: 70%; |
| 167 | + } |
| 168 | +
|
| 169 | + &:active { |
| 170 | + opacity: 30%; |
| 171 | +
|
| 172 | + } |
| 173 | + } |
| 174 | + #greet-input { |
| 175 | + margin-right: 5px; |
| 176 | + } |
| 177 | + #greet-msg { |
| 178 | + opacity: 50%; |
| 179 | + } |
| 180 | +
|
| 181 | + @media (prefers-color-scheme: dark) { |
| 182 | + :root { |
| 183 | + color: #f6f6f6; |
| 184 | + background-color: #1b1b1f; |
| 185 | + } |
| 186 | +
|
| 187 | + input { |
| 188 | + color: #ffffff; |
| 189 | + background-color: #0f0f0f98; |
| 190 | + } |
193 | 191 | } |
194 | | -} |
195 | 192 |
|
196 | 193 | </style> |
0 commit comments