Newest Commit - code same as last commit

This commit is contained in:
2026-02-06 17:32:49 +01:00
parent 7852a77a7c
commit ef09b642d6
64 changed files with 35 additions and 14 deletions

17
src/modules/Terminal.svelte Normal file → Executable file
View File

@@ -10,6 +10,16 @@
const printOutput = (e: HTMLElement, d: PrintData): void => print(e, d);
function getWidth() {
const e = document.getElementById('cout');
if(!e){
throw new Error('cant get width of the teminal element. Its null');
}
const padding: number = parseInt(window.getComputedStyle(e, null).getPropertyValue('padding').slice(0, -2));
console.log(padding);
return e.clientWidth - (padding * 2);
}
function updateTerminal() {
username = terminal!.getUser().username;
cwd = terminal!.getCwd();
@@ -47,7 +57,8 @@
}
}
let callbackInit = {
//Callback initializer
const callbackInit = {
print: (data: any) => {
const e = document.getElementById('outputWrapper');
if (!e) return;
@@ -56,6 +67,7 @@
getWidth: getWidth
};
//Test user with basic data so the bash can run
let testUser: User = {
username: 'kamil',
passwd: '123',
@@ -65,6 +77,7 @@
history: []
};
//Empty terminal variable where the terminal class instance will be stored
let terminal: Terminal;
let username: string = $state(testUser.username);
let cwd: string = $state(testUser.home);
@@ -82,7 +95,7 @@
</script>
<label for="input" onkeydowncapture={(e) => handleInput(e)}>
<div id="terminal" class="terminal-window shadow-() size-full resize rounded-md shadow-bg">
<div id="terminal" class="terminal-window shadow-() size-full rounded-md shadow-bg">
<div
class="terminal-bar flex h-9 w-full flex-row items-center rounded-t-md bg-bg-dark text-center font-terminal text-sm font-bold text-primary-dark light:bg-bg-dark-light light:text-primary-light"
>