Skip to content

Commit c8e5614

Browse files
chore(deps): update dependency svelte to v5 (v2) (#1956)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <[email protected]>
1 parent 03c255a commit c8e5614

File tree

10 files changed

+220
-233
lines changed

10 files changed

+220
-233
lines changed

examples/api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
"devDependencies": {
3333
"@iconify-json/codicon": "^1.1.37",
3434
"@iconify-json/ph": "^1.1.8",
35-
"@sveltejs/vite-plugin-svelte": "^3.0.1",
35+
"@sveltejs/vite-plugin-svelte": "^4.0.0",
3636
"@tauri-apps/cli": "2.0.4",
3737
"@unocss/extractor-svelte": "^0.63.0",
38-
"svelte": "^4.2.19",
38+
"svelte": "^5.0.0",
3939
"unocss": "^0.63.0",
4040
"vite": "^5.4.7"
4141
}

examples/api/src-tauri/capabilities/base.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
}
5454
]
5555
},
56+
"shell:allow-open",
5657
"shell:allow-kill",
5758
"shell:allow-stdin-write",
5859
"process:allow-exit",

examples/api/src/App.svelte

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
if (consoleTextEl) consoleTextEl.scrollTop = consoleTextEl.scrollHeight
206206
}
207207
208-
// this function is renders HTML without sanitizing it so it's insecure
208+
// this function renders HTML without sanitizing it so it's insecure
209209
// we only use it with our own input data
210210
async function insecureRenderHtml(html) {
211211
messages.update((r) => [
@@ -334,56 +334,60 @@
334334
children:h-100% children:w-12 children:inline-flex
335335
children:items-center children:justify-center"
336336
>
337-
<span
337+
<button
338+
aria-label="Toggle dark mode"
338339
title={isDark ? 'Switch to Light mode' : 'Switch to Dark mode'}
339-
class="hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
340+
class="bg-inherit border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
340341
on:click={toggleDark}
341342
>
342343
{#if isDark}
343-
<div class="i-ph-sun" />
344+
<div class="i-ph-sun"></div>
344345
{:else}
345-
<div class="i-ph-moon" />
346+
<div class="i-ph-moon"></div>
346347
{/if}
347-
</span>
348-
<span
348+
</button>
349+
<button
350+
aria-label="Minimize window"
349351
title="Minimize"
350-
class="hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
352+
class="bg-inherit border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
351353
on:click={minimize}
352354
>
353-
<div class="i-codicon-chrome-minimize" />
354-
</span>
355-
<span
355+
<div class="i-codicon-chrome-minimize"></div>
356+
</button>
357+
<button
358+
aria-label="Maximize window"
356359
title={isWindowMaximized ? 'Restore' : 'Maximize'}
357-
class="hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
360+
class="bg-inherit border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
358361
on:click={toggleMaximize}
359362
>
360363
{#if isWindowMaximized}
361-
<div class="i-codicon-chrome-restore" />
364+
<div class="i-codicon-chrome-restore"></div>
362365
{:else}
363-
<div class="i-codicon-chrome-maximize" />
366+
<div class="i-codicon-chrome-maximize"></div>
364367
{/if}
365-
</span>
366-
<span
368+
</button>
369+
<button
370+
aria-label="Close window"
367371
title="Close"
368-
class="hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText"
372+
class="bg-inherit border-none hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText"
369373
on:click={close}
370374
>
371-
<div class="i-codicon-chrome-close" />
372-
</span>
375+
<div class="i-codicon-chrome-close"></div>
376+
</button>
373377
</span>
374378
</div>
375379
{/if}
376380

377381
<!-- Sidebar toggle, only visible on small screens -->
378382
<div
379383
id="sidebarToggle"
380-
class="z-2000 sidebar-toggle display-none lt-sm:flex justify-center absolute items-center w-8 h-8 rd-8
384+
class="z-2000 sidebar-toggle hidden lt-sm:flex justify-center absolute items-center w-8 h-8 rd-8
381385
bg-accent dark:bg-darkAccent active:bg-accentDark dark:active:bg-darkAccentDark"
382386
>
383387
{#if isSideBarOpen}
384-
<span class="i-codicon-close animate-duration-300ms animate-fade-in" />
388+
<span class="i-codicon-close animate-duration-300ms animate-fade-in"></span>
385389
{:else}
386-
<span class="i-codicon-menu animate-duration-300ms animate-fade-in" />
390+
<span class="i-codicon-menu animate-duration-300ms animate-fade-in"></span>
387391
{/if}
388392
</div>
389393

@@ -395,24 +399,21 @@
395399
class="lt-sm:h-screen lt-sm:shadow-lg lt-sm:shadow lt-sm:transition-transform lt-sm:absolute lt-sm:z-1999
396400
bg-darkPrimaryLighter transition-colors-250 overflow-hidden grid select-none px-2"
397401
>
398-
<img
399-
on:click={() => open('https://tauri.app/')}
400-
class="self-center p-7 cursor-pointer"
401-
src="tauri_logo.png"
402-
alt="Tauri logo"
403-
/>
402+
<a href="https://tauri.app" target="_blank">
403+
<img class="p-7" src="tauri_logo.png" alt="Tauri logo" />
404+
</a>
404405
{#if !isWindows}
405406
<a href="##" class="nv justify-between h-8" on:click={toggleDark}>
406407
{#if isDark}
407408
Switch to Light mode
408-
<div class="i-ph-sun" />
409+
<div class="i-ph-sun"></div>
409410
{:else}
410411
Switch to Dark mode
411-
<div class="i-ph-moon" />
412+
<div class="i-ph-moon"></div>
412413
{/if}
413414
</a>
414415
<br />
415-
<div class="bg-white/5 h-2px" />
416+
<div class="bg-white/5 h-2px"></div>
416417
<br />
417418
{/if}
418419

@@ -422,26 +423,26 @@
422423
href="https://tauri.app/v1/guides/"
423424
>
424425
Documentation
425-
<span class="i-codicon-link-external" />
426+
<span class="i-codicon-link-external"></span>
426427
</a>
427428
<a
428429
class="nv justify-between h-8"
429430
target="_blank"
430431
href="https://github.com/tauri-apps/tauri"
431432
>
432433
GitHub
433-
<span class="i-codicon-link-external" />
434+
<span class="i-codicon-link-external"></span>
434435
</a>
435436
<a
436437
class="nv justify-between h-8"
437438
target="_blank"
438439
href="https://github.com/tauri-apps/tauri/tree/dev/examples/api"
439440
>
440441
Source
441-
<span class="i-codicon-link-external" />
442+
<span class="i-codicon-link-external"></span>
442443
</a>
443444
<br />
444-
<div class="bg-white/5 h-2px" />
445+
<div class="bg-white/5 h-2px"></div>
445446
<br />
446447
<div
447448
class="flex flex-col overflow-y-auto children-h-10 children-flex-none gap-1"
@@ -456,7 +457,7 @@
456457
isSideBarOpen = false
457458
}}
458459
>
459-
<div class="{view.icon} mr-2" />
460+
<div class="{view.icon} mr-2"></div>
460461
<p>{view.label}</p></a
461462
>
462463
{/if}
@@ -485,21 +486,23 @@
485486
id="console"
486487
class="select-none h-15rem grid grid-rows-[2px_2rem_1fr] gap-1 overflow-hidden"
487488
>
489+
<!-- svelte-ignore a11y_no_static_element_interactions -->
488490
<div
489491
on:mousedown={startResizingConsole}
490492
class="bg-black/20 h-2px cursor-ns-resize"
491-
/>
493+
></div>
492494
<div class="flex justify-between items-center px-2">
493495
<p class="font-semibold">Console</p>
494-
<div
495-
class="cursor-pointer h-85% rd-1 p-1 flex justify-center items-center
496+
<button
497+
aria-label="Clear Console"
498+
class="cursor-pointer h-85% rd-1 p-1 flex justify-center items-center border-none bg-inherit
496499
hover:bg-hoverOverlay dark:hover:bg-darkHoverOverlay
497500
active:bg-hoverOverlay/25 dark:active:bg-darkHoverOverlay/25
498501
"
499502
on:click={clear}
500503
>
501-
<div class="i-codicon-clear-all" />
502-
</div>
504+
<div class="i-codicon-clear-all"></div>
505+
</button>
503506
</div>
504507
<div
505508
bind:this={consoleTextEl}

examples/api/src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import 'uno.css'
66
import './app.css'
77
import App from './App.svelte'
8+
import { mount } from 'svelte'
89

9-
const app = new App({
10+
const app = mount(App, {
1011
target: document.querySelector('#app')
1112
})
1213

examples/api/src/views/Cli.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<script>
2-
import { getMatches } from "@tauri-apps/plugin-cli";
2+
import { getMatches } from '@tauri-apps/plugin-cli'
33
4-
export let onMessage;
4+
export let onMessage
55
66
function cliMatches() {
7-
getMatches().then(onMessage).catch(onMessage);
7+
getMatches().then(onMessage).catch(onMessage)
88
}
99
</script>
1010

11-
<p>
11+
<div>
1212
This binary can be run from the terminal and takes the following arguments:
1313
<code class="code-block flex flex-wrap my-2">
1414
<pre>
@@ -17,7 +17,7 @@
1717
--verbose</pre>
1818
</code>
1919
Additionally, it has a <code>update --background</code> subcommand.
20-
</p>
20+
</div>
2121
<br />
2222
<div class="note">
2323
Note that the arguments are only parsed, not implemented.

examples/api/src/views/Http.svelte

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
<script>
2-
import { fetch as tauriFetch } from "@tauri-apps/plugin-http";
3-
import { JsonView } from "@zerodevx/svelte-json-view";
2+
import { fetch as tauriFetch } from '@tauri-apps/plugin-http'
3+
import { JsonView } from '@zerodevx/svelte-json-view'
44
5-
let httpMethod = "GET";
6-
let httpBody = "";
5+
let httpMethod = 'GET'
6+
let httpBody = ''
77
8-
export let onMessage;
8+
export let onMessage
99
1010
async function makeHttpRequest() {
11-
let method = httpMethod || "GET";
11+
let method = httpMethod || 'GET'
1212
1313
const options = {
14-
method: method || "GET",
15-
headers: {},
16-
};
14+
method: method || 'GET',
15+
headers: {}
16+
}
1717
18-
let bodyType;
18+
let bodyType
1919
20-
if (method !== "GET") {
21-
options.body = httpBody;
20+
if (method !== 'GET') {
21+
options.body = httpBody
2222
2323
if (
24-
(httpBody.startsWith("{") && httpBody.endsWith("}")) ||
25-
(httpBody.startsWith("[") && httpBody.endsWith("]"))
24+
(httpBody.startsWith('{') && httpBody.endsWith('}')) ||
25+
(httpBody.startsWith('[') && httpBody.endsWith(']'))
2626
) {
27-
options.headers["Content-Type"] = "application/json";
28-
bodyType = "json";
29-
} else if (httpBody !== "") {
30-
bodyType = "text";
27+
options.headers['Content-Type'] = 'application/json'
28+
bodyType = 'json'
29+
} else if (httpBody !== '') {
30+
bodyType = 'text'
3131
}
3232
}
3333
34-
const response = await tauriFetch("http://localhost:3003", options);
34+
const response = await tauriFetch('http://localhost:3003', options)
3535
const body =
36-
bodyType === "json" ? await response.json() : await response.text();
36+
bodyType === 'json' ? await response.json() : await response.text()
3737
3838
onMessage({
3939
url: response.url,
4040
status: response.status,
4141
ok: response.ok,
4242
headers: Object.fromEntries(response.headers.entries()),
43-
body,
44-
});
43+
body
44+
})
4545
}
4646
4747
/// http form
48-
let foo = "baz";
49-
let bar = "qux";
50-
let result = null;
48+
let foo = 'baz'
49+
let bar = 'qux'
50+
let result = null
5151
5252
async function doPost() {
53-
const form = new FormData();
54-
form.append("foo", foo);
55-
form.append("bar", bar);
56-
const response = await tauriFetch("http://localhost:3003/tauri", {
57-
method: "POST",
58-
body: form,
59-
});
53+
const form = new FormData()
54+
form.append('foo', foo)
55+
form.append('bar', bar)
56+
const response = await tauriFetch('http://localhost:3003/tauri', {
57+
method: 'POST',
58+
body: form
59+
})
6060
result = {
6161
url: response.url,
6262
status: response.status,
6363
ok: response.ok,
6464
headers: Object.fromEntries(response.headers.entries()),
65-
body: await response.text(),
66-
};
65+
body: await response.text()
66+
}
6767
}
6868
</script>
6969

@@ -82,7 +82,7 @@
8282
placeholder="Request body"
8383
rows="5"
8484
bind:value={httpBody}
85-
/>
85+
></textarea>
8686
<br />
8787
<button class="btn" id="make-request"> Make request </button>
8888
</form>

0 commit comments

Comments
 (0)