Skip to content

Commit 5f9924e

Browse files
authored
migrate to svelte 5 (#68)
* update dep * migrate to svelte 5 * fix lint * downgrade highcharts, fix check
1 parent f970675 commit 5f9924e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+700
-564
lines changed

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bun 1.1.42
2-
nodejs 22.12.0
1+
bun 1.2.2
2+
nodejs 22.14.0

bun.lockb

6.22 KB
Binary file not shown.

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@
1212
"lint": "eslint ."
1313
},
1414
"devDependencies": {
15-
"@nomimono/nomimono-css": "^0.4.25",
16-
"@sveltejs/adapter-cloudflare": "^4.9.0",
17-
"@sveltejs/adapter-node": "^5.2.11",
18-
"@sveltejs/kit": "=2.11.1",
19-
"@typescript-eslint/eslint-plugin": "^8.18.0",
20-
"@typescript-eslint/parser": "^8.18.0",
15+
"@nomimono/nomimono-css": "^0.6.0",
16+
"@sveltejs/adapter-cloudflare": "^5.0.2",
17+
"@sveltejs/adapter-node": "^5.2.12",
18+
"@sveltejs/kit": "=2.17.1",
19+
"@typescript-eslint/eslint-plugin": "^8.24.0",
20+
"@typescript-eslint/parser": "^8.24.0",
2121
"clipboard": "^2.0.11",
2222
"dayjs": "^1.11.13",
23-
"eslint": "^9.17.0",
23+
"eslint": "^9.20.1",
2424
"eslint-plugin-svelte": "^2.46.1",
2525
"global": "^4.4.0",
2626
"gravatar-url": "^4.0.1",
27-
"highcharts": "^11.4.8",
27+
"highcharts": "=11.4.8",
2828
"js-cookie": "^3.0.5",
29-
"sass": "^1.83.0",
30-
"svelte": "^4.2.19",
31-
"svelte-check": "^4.1.1",
29+
"sass": "^1.84.0",
30+
"svelte": "^5.19.10",
31+
"svelte-check": "^4.1.4",
3232
"svelte-eslint-parser": "^0.43.0",
3333
"svelte-preprocess": "^6.0.3",
34-
"sweetalert2": "^11.14.5",
35-
"typescript": "~5.7.2",
34+
"sweetalert2": "^11.16.0",
35+
"typescript": "~5.7.3",
3636
"valid-url": "^1.0.9"
3737
},
3838
"type": "module"

src/global.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/lib/components/Chart.svelte

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@
44
import * as hc from '$lib/hc'
55
import { browser } from '$app/environment'
66
7-
/** @type {string} */
8-
export let title
9-
10-
/** @type {string} */
11-
export let unit
12-
137
/** @typedef {Object} Series */
148
/** @property {string} prefix */
159
/** @property {Array} lines */
1610
/** @property {string?} dashStyle */
1711
/** @property {string?} color */
1812
19-
/** @type {Series[]} */
20-
export let series
21-
22-
/** @type {'line' | 'spline'} */
23-
export let type = 'line'
13+
/**
14+
* @typedef {Object} Props
15+
* @property {string} title
16+
* @property {string} unit
17+
* @property {Series[]} series
18+
* @property {'line' | 'spline'} [type]
19+
*/
20+
21+
/** @type {Props} */
22+
const {
23+
title,
24+
unit,
25+
series,
26+
type = 'line'
27+
} = $props()
2428
2529
/** @type {HTMLDivElement} */
2630
let el
@@ -53,13 +57,6 @@
5357
}
5458
})
5559
56-
$: {
57-
if (series?.length === 0) clear()
58-
series?.forEach((s) => {
59-
update(s.prefix, s.lines, s.dashStyle, s.color)
60-
})
61-
chart?.redraw()
62-
}
6360
6461
function update (name, lines, dashStyle, color) {
6562
if (!browser || !chart) return
@@ -108,6 +105,14 @@
108105
}
109106
return v
110107
}
108+
109+
$effect(() => {
110+
if (series?.length === 0) clear()
111+
series?.forEach((s) => {
112+
update(s.prefix, s.lines, s.dashStyle, s.color)
113+
})
114+
chart?.redraw()
115+
})
111116
</script>
112117
113118
<div bind:this={el}></div>

src/lib/components/DeploymentStatusIcon.svelte

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22
import { browser } from '$app/environment'
33
import { onDestroy } from 'svelte'
44
5-
/** @type {Api.DeploymentAction} */
6-
export let action
7-
8-
/** @type {Api.DeploymentStatus} */
9-
export let status
10-
11-
/** @type {string} */
12-
export let url
5+
/**
6+
* @typedef {Object} Props
7+
* @property {Api.DeploymentAction} action
8+
* @property {Api.DeploymentStatus} status
9+
* @property {string} url
10+
* @property {Api.DeploymentType} type
11+
*/
1312
14-
/** @type {Api.DeploymentType} */
15-
export let type
13+
/** @type {Props} */
14+
const {
15+
action,
16+
status,
17+
url,
18+
type
19+
} = $props()
1620
1721
const statusIconClass = {
1822
pending: 'fa-solid fa-spinner-third fa-spin',
@@ -22,21 +26,10 @@
2226
}
2327
2428
/** @type {Api.PodStatus | null} */
25-
let podStatus
29+
let podStatus = $state(null)
2630
2731
/** @type {string} */
28-
let iconClass
29-
30-
$: {
31-
status
32-
url
33-
action
34-
browser && fetchPodStatus()
35-
}
36-
$: {
37-
podStatus
38-
iconClass = getIconClass()
39-
}
32+
let iconClass = $state('')
4033
4134
/**
4235
* @returns {string}
@@ -93,6 +86,16 @@
9386
destroyed = true
9487
fetchPodStatusTimeout && clearTimeout(fetchPodStatusTimeout)
9588
})
89+
$effect(() => {
90+
status
91+
url
92+
action
93+
browser && fetchPodStatus()
94+
})
95+
$effect(() => {
96+
podStatus
97+
iconClass = getIconClass()
98+
})
9699
</script>
97100

98101
<i class={`${iconClass} _mgh-5`}></i>

src/lib/components/ErrorRow.svelte

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
<script>
2-
export let span = 1
3-
export let error
2+
/**
3+
* @typedef {Object} Props
4+
* @property {number} [span]
5+
* @property {any} error
6+
*/
7+
8+
/** @type {Props} */
9+
const { span = 1, error } = $props()
410
</script>
511

612
{#if error}
7-
<td colspan={span} class="_tal-ct">
8-
{#if error.forbidden}
9-
You don't have permission to view data
10-
{:else if error.message}
11-
{error.message}
12-
{:else}
13-
{error}
14-
{/if}
15-
</td>
13+
<tr>
14+
<td colspan={span} class="_tal-ct">
15+
{#if error.forbidden}
16+
You don't have permission to view data
17+
{:else if error.message}
18+
{error.message}
19+
{:else}
20+
{error}
21+
{/if}
22+
</td>
23+
</tr>
1624
{/if}

src/lib/components/LoadingRow.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<script>
2-
export let span = 1
2+
/**
3+
* @typedef {Object} Props
4+
* @property {number} [span]
5+
*/
6+
7+
/** @type {Props} */
8+
const { span = 1 } = $props()
39
</script>
410

511
<td colspan={span} class="_tal-ct">
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<script>
2-
export let span = 1
3-
export let list = []
2+
/**
3+
* @typedef {Object} Props
4+
* @property {number} [span]
5+
* @property {any} [list]
6+
*/
7+
8+
/** @type {Props} */
9+
const { span = 1, list = [] } = $props()
410
</script>
511

612
{#if !list?.length}
7-
<td colspan={span} class="_tal-ct">
8-
No data
9-
</td>
13+
<tr>
14+
<td colspan={span} class="_tal-ct">
15+
No data
16+
</td>
17+
</tr>
1018
{/if}

src/lib/components/Secret.svelte

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<script>
2-
/** @type {string} */
3-
export let value
42
5-
let isHidden = true
3+
/**
4+
* @typedef {Object} Props
5+
* @property {string} value
6+
*/
7+
8+
/** @type {Props} */
9+
const { value } = $props()
10+
11+
let isHidden = $state(true)
612
713
function toggle () {
814
isHidden = !isHidden
915
}
1016
</script>
1117

1218
<span>
13-
<div on:click={toggle} on:keypress={toggle} tabindex="0" role="link">
19+
<div onclick={toggle} onkeypress={toggle} tabindex="0" role="link">
1420
{#if isHidden}
1521
<i class="fa-solid fa-eye"></i>
1622
{:else}

0 commit comments

Comments
 (0)