Initial migration to Svelte5 via full syntax compatability

- updated all dependencies
- removed svelte-chartjs wrapper from dependencies
- sveltestrap causes compilation warnings (once)
- Header.svelte uses new Svelte5 syntax as example
- fixed most initial compilation warnings except circular dependencies with TBD cause
This commit is contained in:
Christoph Kluge
2025-02-03 17:31:01 +01:00
parent 1e63cdbcda
commit 5681062f01
27 changed files with 561 additions and 471 deletions

View File

@@ -259,7 +259,7 @@
<!-- Define Wrapper and NoData Card within $width -->
<div bind:clientWidth={width}>
{#if data.length > 0}
<div bind:this={plotWrapper} />
<div bind:this={plotWrapper}></div>
{:else}
<Card class="mx-4" body color="warning"
>Cannot render histogram: No data!</Card

View File

@@ -607,7 +607,7 @@
{#if series[0]?.data && series[0].data.length > 0}
<div bind:this={plotWrapper} bind:clientWidth={width}
style="background-color: {backgroundColor()};" class={forNode ? 'py-2 rounded' : 'rounded'}
/>
></div>
{:else}
<Card body color="warning" class="mx-4"
>Cannot render plot: No series data returned for <code>{metric}</code></Card

View File

@@ -1,5 +1,5 @@
<!--
@component Pie Plot based on uPlot Pie
@component Pie Plot based on chart.js Pie
Properties:
- `size Number`: X and Y size of the plot, for square shape
@@ -31,33 +31,17 @@
]
</script>
<script>
import { Pie } from 'svelte-chartjs';
import {
Chart as ChartJS,
Title,
Tooltip,
Legend,
Filler,
ArcElement,
CategoryScale
} from 'chart.js';
ChartJS.register(
Title,
Tooltip,
Legend,
Filler,
ArcElement,
CategoryScale
);
import Chart from 'chart.js/auto'
import { onMount } from 'svelte';
export let canvasId
export let size
export let sliceLabel
export let quantities
export let entities
export let displayLegend = false
$: data = {
const data = {
labels: entities,
datasets: [
{
@@ -79,10 +63,22 @@
}
}
onMount(() => {
new Chart(
document.getElementById(canvasId),
{
type: 'pie',
data: data,
options: options
}
);
});
</script>
<!-- <div style="width: 500px;"><canvas id="dimensions"></canvas></div><br/> -->
<div class="chart-container" style="--container-width: {size}; --container-height: {size}">
<Pie {data} {options}/>
<canvas id={canvasId}></canvas>
</div>
<style>

View File

@@ -1,5 +1,5 @@
<!--
@component Polar Plot based on chartJS Radar
@component Polar Plot based on chart.js Radar
Properties:
- `footprintData [Object]?`: job.footprint content, evaluated in regards to peak config in jobSummary.svelte [Default: null]
@@ -11,29 +11,10 @@
-->
<script>
import { getContext } from 'svelte'
import { Radar } from 'svelte-chartjs';
import {
Chart as ChartJS,
Title,
Tooltip,
Legend,
Filler,
PointElement,
RadialLinearScale,
LineElement
} from 'chart.js';
ChartJS.register(
Title,
Tooltip,
Legend,
Filler,
PointElement,
RadialLinearScale,
LineElement
);
import { getContext, onMount } from 'svelte'
import Chart from 'chart.js/auto'
export let canvasId;
export let footprintData = null;
export let metrics = null;
export let cluster = null;
@@ -183,10 +164,23 @@
}
}
onMount(() => {
new Chart(
document.getElementById(canvasId),
{
type: 'radar',
data: data,
options: options,
height: height
}
);
});
</script>
<!-- <div style="width: 500px;"><canvas id="dimensions"></canvas></div><br/> -->
<div class="chart-container">
<Radar {data} {options} {height}/>
<canvas id={canvasId}></canvas>
</div>
<style>

View File

@@ -363,7 +363,7 @@
</script>
{#if data != null}
<div bind:this={plotWrapper} class="p-2"/>
<div bind:this={plotWrapper} class="p-2"></div>
{:else}
<Card class="mx-4" body color="warning">Cannot render roofline: No data!</Card
>