New look (not finished)

This commit is contained in:
2026-11-06 18:00:58 +01:00
parent 2a0d54c19e
commit d030393644
6 changed files with 124 additions and 17 deletions
+48 -3
View File
@@ -1,27 +1,72 @@
<script lang="ts">
import Input from '#lib/modules/Input.svelte';
import StatusBar from '#lib/modules/StatusBar.svelte';
import Terminal from '#lib/modules/Terminal.svelte';
import type { MWinAPI } from '#lib/mwinlib/mwin_util.ts';
import { mount, onMount, unmount } from 'svelte';
let api: MWinAPI | undefined = $state();
let value = $state('');
let input: Input | undefined = $state();
let date = $state(new Date());
let wrapper: HTMLElement;
let index: number = $state(-1);
const instances = new Map<number, ReturnType<typeof mount>>();
function add() {
index++;
const id = index;
const terminal = mount(Terminal, {
target: wrapper,
props: {
id,
wrapper,
username: 'gornodox',
hostname: 'termos',
working_dir: '~',
mwin: api,
close: remove
}
});
instances.set(id, terminal);
}
function remove(id: number): void {
const m = instances.get(id);
if (!m) return;
unmount(m);
instances.delete(id);
}
$effect(() => {
setInterval(() => {
date = new Date();
}, 1000);
});
onMount(() => {
window.addEventListener('keydown', (e) => {
if (e.altKey && e.key === 'n') {
add();
}
});
});
</script>
<div class="h-dvh w-full p-4">
<div class=" bg-pattern flex h-full flex-col rounded-md">
<div class="relative flex flex-1"></div>
<div class=" bg-bg-full flex h-full flex-col rounded-md">
<div bind:this={wrapper} id="terminal-wrapper" class="relative flex flex-1"></div>
<div class="bg-bg-soft border-bg3 w-full rounded-b-md border-t text-xs">
<StatusBar
username="gornodox"
theme="gruvbox"
windowCount="no"
windowCount={0}
windowTitle="Hello, World!"
version="v0.0.1_alpha"
hash="a3d5b1c"
/>