Migrate frontend to Svelte 5 runes semantics

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

View File

@@ -3,7 +3,7 @@
@SEMANTICS: form, schema, dynamic, json-schema
@PURPOSE: Generates a form dynamically based on a JSON schema.
@LAYER: UI
@RELATION: DEPENDS_ON -> svelte:createEventDispatcher
@RELATION: BINDS_TO -> onsubmit callback
@PROPS:
- schema: Object - JSON schema for the form.
@@ -11,27 +11,22 @@
- submit: Object - Dispatched when the form is submitted, containing the form data.
-->
<script>
// [SECTION: IMPORTS]
import { createEventDispatcher } from 'svelte';
// [/SECTION]
let {
schema,
onsubmit = () => {},
} = $props();
let formData = {};
const dispatch = createEventDispatcher();
// [DEF:handleSubmit:Function]
/**
* @purpose Dispatches the submit event with the form data.
* @purpose Emits submitted form data via callback prop.
* @pre formData contains user input.
* @post 'submit' event is dispatched with formData.
* @post Parent callback receives formData snapshot.
*/
function handleSubmit() {
console.log("[DynamicForm][Action] Submitting form data.", { formData });
dispatch('submit', formData);
onsubmit(formData);
}
// [/DEF:handleSubmit:Function]
@@ -54,7 +49,7 @@
</script>
<!-- [SECTION: TEMPLATE] -->
<form on:submit|preventDefault={handleSubmit} class="space-y-4">
<form onsubmit={(event) => { event.preventDefault(); handleSubmit(); }} class="space-y-4">
{#if schema && schema.properties}
{#each Object.entries(schema.properties) as [key, prop]}
<div class="flex flex-col">