Migrate frontend to Svelte 5 runes semantics

This commit is contained in:
2026-03-11 11:29:24 +03:00
parent 765178f12e
commit 0083d9054e
61 changed files with 989 additions and 922 deletions

View File

@@ -10,7 +10,6 @@
<script lang="ts">
// [SECTION: IMPORTS]
import { onMount, createEventDispatcher } from 'svelte';
import { t } from '../lib/i18n';
// [/SECTION]
@@ -19,23 +18,22 @@
label = "",
selectedId = "",
environments = [],
onchange = () => {},
} = $props();
// [/SECTION]
const dispatch = createEventDispatcher();
// [DEF:handleSelect:Function]
/**
* @purpose Dispatches the selection change event.
* @purpose Propagates the selection change through a callback prop.
* @pre event.target must be an HTMLSelectElement.
* @post selectedId is updated and 'change' event is dispatched.
* @post selectedId is updated and parent callback receives the selected environment id.
* @param {Event} event - The change event from the select element.
*/
function handleSelect(event: Event) {
const target = event.target as HTMLSelectElement;
selectedId = target.value;
dispatch('change', { id: selectedId });
onchange({ id: selectedId });
}
// [/DEF:handleSelect:Function]
</script>
@@ -47,7 +45,7 @@
id="env-select"
class="block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md"
value={selectedId}
on:change={handleSelect}
onchange={handleSelect}
>
<option value="" disabled>{$t.common?.choose_environment}</option>
{#each environments as env}