Skip to content

Commit 233116f

Browse files
committed
migration to svele 5
1 parent 91619c6 commit 233116f

19 files changed

+188
-80
lines changed

website/bun.lockb

1.96 KB
Binary file not shown.

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"ml-regression-simple-linear": "3.0.1",
2323
"regression": "^2.0.1",
2424
"sharp": "^0.33.5",
25-
"svelte": "^4.2.19",
25+
"svelte": "^5.1.4",
2626
"typescript": "^5.6.3",
2727
"zod": "^3.23.8"
2828
}

website/src/components/svelte/genericCharts/barChart.svelte

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,37 @@
44
import { ThemeObserver } from '../svelteUtils.ts';
55
import type { ChartDataset } from 'chart.js/dist/types';
66
7-
export let dataPoints: number[];
8-
export let dataPoints2: number[] | undefined = undefined;
9-
export let labels: string[];
10-
export let showDatalabels = false;
11-
export let showXLabels = true;
12-
export let seriesName = '';
13-
export let seriesName2 = '';
14-
export let aspectRatio = 1;
15-
export let logScale = false;
16-
export let calculatePrecentages = false;
17-
export let percent100 = 1;
18-
export let stacked = false;
19-
20-
export let colors = [
7+
8+
interface Props {
9+
dataPoints: number[];
10+
dataPoints2?: number[] | undefined;
11+
labels: string[];
12+
showDatalabels?: boolean;
13+
showXLabels?: boolean;
14+
seriesName?: string;
15+
seriesName2?: string;
16+
aspectRatio?: number;
17+
logScale?: boolean;
18+
calculatePrecentages?: boolean;
19+
percent100?: number;
20+
stacked?: boolean;
21+
colors?: any;
22+
}
23+
24+
let {
25+
dataPoints,
26+
dataPoints2 = undefined,
27+
labels,
28+
showDatalabels = false,
29+
showXLabels = true,
30+
seriesName = '',
31+
seriesName2 = '',
32+
aspectRatio = 1,
33+
logScale = false,
34+
calculatePrecentages = false,
35+
percent100 = 1,
36+
stacked = false,
37+
colors = [
2138
'rgba(255, 99, 132, 1)', // Red
2239
'rgba(54, 162, 235, 1)', // Blue
2340
'rgba(255, 205, 86, 1)', // Yellow
@@ -33,9 +50,10 @@
3350
'rgba(255, 184, 77, 1)', // Mustard
3451
'rgba(145, 232, 225, 1)', // Aqua
3552
'rgba(236, 112, 99, 1)', // Salmon
36-
];
53+
]
54+
}: Props = $props();
3755
38-
let downloadChartEl: HTMLCanvasElement;
56+
let downloadChartEl: HTMLCanvasElement = $state();
3957
4058
let themeObserver: ThemeObserver;
4159

website/src/components/svelte/genericCharts/dataPerMonthChart.svelte

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@
44
import { type PerMonthDataPoint } from '../../../../../src/types.ts';
55
import { ThemeObserver } from '../svelteUtils.ts';
66
7-
export let dataPoints: PerMonthDataPoint[];
8-
export let title: string;
9-
export let min: number = 0;
10-
export let max: number | undefined = undefined;
11-
export let type: 'bar' | 'line' = 'bar';
7+
interface Props {
8+
dataPoints: PerMonthDataPoint[];
9+
title: string;
10+
min?: number;
11+
max?: number | undefined;
12+
type?: 'bar' | 'line';
13+
}
14+
15+
let {
16+
dataPoints,
17+
title,
18+
min = 0,
19+
max = undefined,
20+
type = 'bar'
21+
}: Props = $props();
1222
13-
let chartEl: HTMLCanvasElement;
23+
let chartEl: HTMLCanvasElement = $state();
1424
1525
let themeObserver: ThemeObserver;
1626

website/src/components/svelte/genericCharts/multiLineBarChart.svelte

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44
import { type PerMonthDataPoint } from '../../../../../src/types.ts';
55
import { ThemeObserver } from '../svelteUtils.ts';
66
7-
export let dataPoints: PerMonthDataPoint[][];
8-
export let setLabels: string[];
9-
export let labels: string[];
10-
export let min: number = 0;
11-
export let max: number | undefined = undefined;
12-
export let type: 'bar' | 'line' = 'bar';
137
14-
export let colors = [
8+
interface Props {
9+
dataPoints: PerMonthDataPoint[][];
10+
setLabels: string[];
11+
labels: string[];
12+
min?: number;
13+
max?: number | undefined;
14+
type?: 'bar' | 'line';
15+
colors?: any;
16+
}
17+
18+
let {
19+
dataPoints,
20+
setLabels,
21+
labels,
22+
min = 0,
23+
max = undefined,
24+
type = 'bar',
25+
colors = [
1526
'rgba(255, 99, 132, 1)', // Red
1627
'rgba(54, 162, 235, 1)', // Blue
1728
'rgba(255, 205, 86, 1)', // Yellow
@@ -27,9 +38,10 @@
2738
'rgba(255, 184, 77, 1)', // Mustard
2839
'rgba(145, 232, 225, 1)', // Aqua
2940
'rgba(236, 112, 99, 1)', // Salmon
30-
];
41+
]
42+
}: Props = $props();
3143
32-
let chartEl: HTMLCanvasElement;
44+
let chartEl: HTMLCanvasElement = $state();
3345
3446
let themeObserver: ThemeObserver;
3547

website/src/components/svelte/genericCharts/pieChart.svelte

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
import { onDestroy, onMount } from 'svelte';
44
import { ThemeObserver } from '../svelteUtils.ts';
55
6-
let downloadChartEl: HTMLCanvasElement;
6+
let downloadChartEl: HTMLCanvasElement = $state();
77
88
let themeObserver: ThemeObserver;
99
10-
export let dataPoints: { label: string; value: number }[];
11-
export let colors = [
10+
interface Props {
11+
dataPoints: { label: string; value: number }[];
12+
colors?: any;
13+
isPercentual?: boolean;
14+
showDatalabels?: boolean;
15+
calculatePrecentages?: boolean;
16+
}
17+
18+
let {
19+
dataPoints,
20+
colors = [
1221
'rgba(255, 99, 132, 1)', // Red
1322
'rgba(54, 162, 235, 1)', // Blue
1423
'rgba(255, 205, 86, 1)', // Yellow
@@ -24,10 +33,11 @@
2433
'rgba(255, 184, 77, 1)', // Mustard
2534
'rgba(145, 232, 225, 1)', // Aqua
2635
'rgba(236, 112, 99, 1)', // Salmon
27-
];
28-
export let isPercentual = false;
29-
export let showDatalabels = false;
30-
export let calculatePrecentages = false;
36+
],
37+
isPercentual = false,
38+
showDatalabels = false,
39+
calculatePrecentages = false
40+
}: Props = $props();
3141
3242
onMount(() => {
3343
themeObserver = new ThemeObserver();

website/src/components/svelte/genericCharts/stackedBarChart.svelte

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@
44
import { ThemeObserver } from '../svelteUtils.ts';
55
import { ALL_OS } from '../../../../../src/release/release.ts';
66
7-
export let dataPoints: { label: string; data: number[] }[];
8-
export let labels: string[];
9-
export let colors = [
7+
interface Props {
8+
dataPoints: { label: string; data: number[] }[];
9+
labels: string[];
10+
colors?: any;
11+
isPercentual?: boolean;
12+
showDatalabels?: boolean;
13+
}
14+
15+
let {
16+
dataPoints,
17+
labels,
18+
colors = [
1019
'rgba(255, 99, 132, 1)', // Red
1120
'rgba(54, 162, 235, 1)', // Blue
1221
'rgba(255, 205, 86, 1)', // Yellow
@@ -22,11 +31,12 @@
2231
'rgba(255, 184, 77, 1)', // Mustard
2332
'rgba(145, 232, 225, 1)', // Aqua
2433
'rgba(236, 112, 99, 1)', // Salmon
25-
];
26-
export let isPercentual = false;
27-
export let showDatalabels = false;
34+
],
35+
isPercentual = false,
36+
showDatalabels = false
37+
}: Props = $props();
2838
29-
let downloadChartEl: HTMLCanvasElement;
39+
let downloadChartEl: HTMLCanvasElement = $state();
3040
3141
let themeObserver: ThemeObserver;
3242

website/src/components/svelte/helpers/commit.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<script lang="ts">
22
import type { Commit } from '../../../../../src/types.ts';
33
4-
export let commit: Commit;
4+
interface Props {
5+
commit: Commit;
6+
}
7+
8+
let { commit }: Props = $props();
59
let url = 'https://github.com/obsidianmd/obsidian-releases/commit/' + commit.hash;
610
</script>
711

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script lang="ts">
2-
export let repo: string;
2+
interface Props {
3+
repo: string;
4+
}
5+
6+
let { repo }: Props = $props();
37
</script>
48

59
<a href={'https://github.com/' + repo} target="_blank">{repo}</a>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<script lang="ts">
22
import slug from 'slug';
33
4-
export let id: string;
4+
interface Props {
5+
id: string;
6+
}
7+
8+
let { id }: Props = $props();
59
</script>
610

711
<a href={'/obsidian-stats/plugins/' + slug(id)}>{id}</a>

0 commit comments

Comments
 (0)