project map script | semantic parcer

This commit is contained in:
2026-01-01 16:58:21 +03:00
parent a747a163c8
commit 4c6fc8256d
84 changed files with 10178 additions and 537 deletions

View File

@@ -22,6 +22,8 @@
let autoScroll = true;
let logContainer;
// [DEF:fetchLogs:Function]
// @PURPOSE: Fetches logs for the current task.
async function fetchLogs() {
if (!taskId) return;
try {
@@ -35,7 +37,10 @@
loading = false;
}
}
// [/DEF:fetchLogs:Function]
// [DEF:scrollToBottom:Function]
// @PURPOSE: Scrolls the log container to the bottom.
function scrollToBottom() {
if (logContainer) {
setTimeout(() => {
@@ -43,7 +48,10 @@
}, 0);
}
}
// [/DEF:scrollToBottom:Function]
// [DEF:handleScroll:Function]
// @PURPOSE: Updates auto-scroll preference based on scroll position.
function handleScroll() {
if (!logContainer) return;
// If user scrolls up, disable auto-scroll
@@ -51,12 +59,18 @@
const atBottom = scrollHeight - scrollTop - clientHeight < 50;
autoScroll = atBottom;
}
// [/DEF:handleScroll:Function]
// [DEF:close:Function]
// @PURPOSE: Closes the log viewer modal.
function close() {
dispatch('close');
show = false;
}
// [/DEF:close:Function]
// [DEF:getLogLevelColor:Function]
// @PURPOSE: Returns the CSS color class for a given log level.
function getLogLevelColor(level) {
switch (level) {
case 'INFO': return 'text-blue-600';
@@ -66,6 +80,7 @@
default: return 'text-gray-800';
}
}
// [/DEF:getLogLevelColor:Function]
// React to changes in show/taskId
$: if (show && taskId) {
@@ -82,9 +97,12 @@
if (interval) clearInterval(interval);
}
// [DEF:onDestroy:Function]
// @PURPOSE: Cleans up the polling interval.
onDestroy(() => {
if (interval) clearInterval(interval);
});
// [/DEF:onDestroy:Function]
</script>
{#if show}
@@ -150,4 +168,4 @@
</div>
</div>
{/if}
<!-- [/DEF:TaskLogViewer] -->
<!-- [/DEF:TaskLogViewer:Component] -->