Build ready commit
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
let scrollDiv: HTMLElement;
|
||||
let stdout: string = '';
|
||||
let count: [string, string, string][] = $state([]);
|
||||
let pwd: string = working_dir;
|
||||
|
||||
const mwinoptions: Partial<MWinParams> = {
|
||||
handle: '#terminal-bar',
|
||||
@@ -47,7 +48,7 @@
|
||||
async function onsubmit(value: string) {
|
||||
const input = value.trim();
|
||||
await shell!.execute(input);
|
||||
scrollDiv.scrollTop = scrollDiv.scrollHeight;
|
||||
pwd = resolvePointerToHome(shell!.State, shell!.Session.cwd);
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
@@ -60,7 +61,8 @@
|
||||
if (payload.result.type === 'error') {
|
||||
stdout = stdout + payload.result.error.message + '\n';
|
||||
}
|
||||
count.push([inputValue, resolvePointerToHome(shell!.State, shell!.Session.cwd), stdout]);
|
||||
working_dir = resolvePointerToHome(shell!.State, shell!.Session.cwd);
|
||||
count.push([inputValue, pwd, stdout]);
|
||||
stdout = '';
|
||||
inputValue = '';
|
||||
});
|
||||
@@ -90,19 +92,19 @@
|
||||
<div class="dots-wrapper m-auto mx-3 flex size-max flex-row items-center justify-center gap-2">
|
||||
<button
|
||||
data-close-btn
|
||||
class="bg-term-close h-2.5 w-2.5 cursor-pointer rounded-full active:brightness-85"
|
||||
class="bg-tl-red h-2.5 w-2.5 cursor-pointer rounded-full active:brightness-85"
|
||||
type="button"
|
||||
aria-label="Close terminal"
|
||||
onclick={() => close?.(id)}
|
||||
></button>
|
||||
<button
|
||||
class="bg-term-maximize h-2.5 w-2.5 cursor-pointer rounded-full active:brightness-85"
|
||||
class="bg-tl-yellow h-2.5 w-2.5 cursor-pointer rounded-full active:brightness-85"
|
||||
type="button"
|
||||
aria-label="Maximize terminal"
|
||||
onclick={() => mwin?.maximize()}
|
||||
></button>
|
||||
<button
|
||||
class="bg-term-minimize h-2.5 w-2.5 cursor-pointer rounded-2xl active:brightness-85"
|
||||
class="bg-tl-green h-2.5 w-2.5 cursor-pointer rounded-2xl active:brightness-85"
|
||||
type="button"
|
||||
aria-label="Minimize terminal"
|
||||
></button>
|
||||
@@ -126,8 +128,8 @@
|
||||
{/each}
|
||||
</div>
|
||||
<span
|
||||
><span class=" text-tyellow">{username}</span><span>@</span><span class=" text-fg1"
|
||||
>{hostname}</span
|
||||
><span class=" text-tyellow">{shell!.Session.user.username}</span><span>@</span><span
|
||||
class=" text-fg1">{hostname}</span
|
||||
>
|
||||
<span class="text-bg4">{working_dir}</span><br /></span
|
||||
>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<main
|
||||
class="text-text bg-bg-base m-auto flex min-h-dvh w-full flex-col items-center justify-center overflow-hidden"
|
||||
class:dark={$theme === 'dark'}
|
||||
class:light={$theme === 'light'}
|
||||
>
|
||||
<ToastsModule />
|
||||
{@render children()}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
let value = $state('');
|
||||
let input: Input | undefined = $state();
|
||||
let working_dir = $state('');
|
||||
|
||||
let date = $state(new Date());
|
||||
|
||||
@@ -47,7 +48,7 @@
|
||||
wrapper,
|
||||
username: shell!.Session.user.username,
|
||||
hostname: 'termos',
|
||||
working_dir: resolvePointerToHome(shell!.State, shell!.Session.user.home),
|
||||
working_dir: resolvePointerToHome(shell!.State, shell!.Session.cwd),
|
||||
mwin: api,
|
||||
shell,
|
||||
close: remove
|
||||
@@ -97,10 +98,10 @@
|
||||
<StatusBar
|
||||
username="gornodox"
|
||||
theme="gruvbox"
|
||||
windowCount={instances.size}
|
||||
windowCount={index + 1}
|
||||
windowTitle="Termos"
|
||||
version="v0.1.1_alpha"
|
||||
hash="a3d5b1c"
|
||||
hash="57773fc2ef"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { rawJson } from '#lib/assets/fs.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';
|
||||
import { resolvePointerToHome, Termos, type Shell } from 'termos';
|
||||
|
||||
const config = {
|
||||
groups: ['users'],
|
||||
users: [
|
||||
{
|
||||
username: 'gornodox',
|
||||
groups: ['users', 'sudoers'],
|
||||
home: '/home/gornodox'
|
||||
}
|
||||
],
|
||||
general: {
|
||||
user: 'gornodox'
|
||||
},
|
||||
filesystem: {
|
||||
json: rawJson
|
||||
}
|
||||
};
|
||||
|
||||
let shell: Shell | undefined = $state();
|
||||
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: shell!.Session.user.username,
|
||||
hostname: 'termos',
|
||||
working_dir: resolvePointerToHome(shell!.State, shell!.Session.user.home),
|
||||
mwin: api,
|
||||
shell,
|
||||
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(async () => {
|
||||
shell = await Termos.getShell(config);
|
||||
|
||||
window.addEventListener('keydown', (e) => {
|
||||
if (e.ctrlKey && e.altKey && e.key === 't') {
|
||||
add();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="h-dvh w-full p-4">
|
||||
<div class=" bg-bg-full flex h-full flex-col rounded-md">
|
||||
<div class="absolute top-12 left-1/2 -translate-x-1/2">
|
||||
<span class="text-fg1 inline-flex items-baseline gap-2 font-mono text-sm tracking-[0.02em]">
|
||||
<span class="text-fg3">Ctrl</span>
|
||||
<span class="text-bg4 select-none" aria-hidden="true">+</span>
|
||||
<span class="text-fg3">Alt</span>
|
||||
<span class="text-bg4 select-none" aria-hidden="true">+</span>
|
||||
<span class="text-tyellow font-semibold">T</span>
|
||||
</span>
|
||||
</div>
|
||||
<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={instances.size}
|
||||
windowTitle="Termos"
|
||||
version="v0.1.1_alpha"
|
||||
hash="a3d5b1c"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="h-dvh w-full p-4">
|
||||
<div class="bg-bg-soft border-border text-glow size-full rounded-xl font-mono tracking-widest">
|
||||
<div class=" border-border grid grid-cols-[1fr_auto_1fr] rounded-t-xl border-b px-2 py-1.5">
|
||||
<div></div>
|
||||
<div class="text-fg text-[10px] uppercase">
|
||||
<span class="">gornodox@termos</span>
|
||||
<span class=" normal-case"> — ~/Downloads</span>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div
|
||||
class=" bg-bg border-border fixed bottom-full grid grid-cols-[1fr_auto_1fr] rounded-b-xl border-b px-2 py-1.5"
|
||||
>
|
||||
<div></div>
|
||||
<div class="text-fg text-[10px] uppercase">
|
||||
<span class="">gornodox@termos</span>
|
||||
<span class=" normal-case"> — ~/Downloads</span>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <div
|
||||
onclick={() => input?.focusInput()}
|
||||
onkeydown={() => input?.focusInput()}
|
||||
role="textbox"
|
||||
tabindex="-1"
|
||||
class=" bg-bg-base scroll-hidden text-glow relative h-screen w-full overflow-y-auto p-4 text-sm"
|
||||
>
|
||||
<Input bind:value blinkDelay={500} bind:this={input} />
|
||||
</div>
|
||||
<div class="bg-bg fixed bottom-0 flex w-full flex-row px-3">
|
||||
<p class="text-md">Uptime: 09:10:01</p>
|
||||
</div> -->
|
||||
@@ -1,19 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Terminal } from '@wterm/svelte';
|
||||
import '@wterm/svelte/css';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let term: Terminal;
|
||||
|
||||
function print() {
|
||||
term.write('Hello, World!');
|
||||
}
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
globalThis.__debug = { print };
|
||||
}
|
||||
|
||||
onMount(() => {});
|
||||
</script>
|
||||
|
||||
<Terminal bind:this={term} theme="monokai" />
|
||||
+1
-76
@@ -165,88 +165,13 @@
|
||||
transform 50ms linear;
|
||||
}
|
||||
|
||||
:root {
|
||||
/*
|
||||
================================================================
|
||||
LIGHT THEME
|
||||
================================================================
|
||||
*/
|
||||
|
||||
/* Lavender scale */
|
||||
--color-lavender-50: oklch(0.975 0.02 290);
|
||||
--color-lavender-100: oklch(0.945 0.04 290);
|
||||
--color-lavender-200: oklch(0.875 0.08 285);
|
||||
--color-lavender-300: oklch(0.775 0.14 280);
|
||||
--color-lavender-400: oklch(0.665 0.18 275);
|
||||
--color-lavender-500: oklch(0.555 0.2 270);
|
||||
--color-lavender-600: oklch(0.465 0.22 265);
|
||||
--color-lavender-700: oklch(0.39 0.22 260);
|
||||
--color-lavender-800: oklch(0.31 0.18 255);
|
||||
--color-lavender-900: oklch(0.25 0.14 250);
|
||||
|
||||
/* Neutral grey scale (harmonised hue ~270) */
|
||||
--color-gray-50: oklch(0.98 0 0);
|
||||
--color-gray-100: oklch(0.95 0.002 270);
|
||||
--color-gray-200: oklch(0.88 0.003 270);
|
||||
--color-gray-300: oklch(0.78 0.005 270);
|
||||
--color-gray-400: oklch(0.65 0.008 270);
|
||||
--color-gray-500: oklch(0.52 0.01 270);
|
||||
--color-gray-600: oklch(0.4 0.012 270);
|
||||
--color-gray-700: oklch(0.28 0.012 270);
|
||||
--color-gray-800: oklch(0.18 0.008 270);
|
||||
--color-gray-900: oklch(0.13 0.005 270);
|
||||
|
||||
/* Semantic tokens – Light */
|
||||
--color-primary: var(--color-lavender-700);
|
||||
--color-primary-variant: var(--color-lavender-500);
|
||||
--color-secondary: oklch(0.6 0.11 170);
|
||||
--color-secondary-variant: oklch(0.7 0.14 170);
|
||||
--color-info: oklch(0.58 0.13 250);
|
||||
--color-info-container: oklch(0.95 0.04 250);
|
||||
|
||||
/* Background depth */
|
||||
--color-bg-base: oklch(1 0 0);
|
||||
--color-surface-1: oklch(0.975 0.02 290);
|
||||
--color-surface-2: oklch(0.96 0.03 290);
|
||||
--color-surface-3: oklch(0.93 0.06 285);
|
||||
--color-surface-4: oklch(0.89 0.08 280);
|
||||
--color-border: var(--color-lavender-200);
|
||||
|
||||
/* Typography */
|
||||
--color-text-primary: oklch(0.18 0.02 270);
|
||||
--color-text-secondary: oklch(0.42 0.03 270);
|
||||
--color-text-on-primary: oklch(1 0 0);
|
||||
--color-muted: oklch(0.55 0.01 270);
|
||||
--color-link: var(--color-primary-variant);
|
||||
--color-link-hover: var(--color-primary);
|
||||
|
||||
/* Semantic states */
|
||||
--color-error: oklch(0.6 0.2 15);
|
||||
--color-error-container: oklch(0.95 0.03 15);
|
||||
--color-success: oklch(0.55 0.1 160);
|
||||
--color-success-container: oklch(0.93 0.05 155);
|
||||
--color-warning: oklch(0.65 0.15 75);
|
||||
--color-warning-container: oklch(0.96 0.08 75);
|
||||
|
||||
/* Extra utilities */
|
||||
--color-focus-ring: oklch(0.39 0.22 260 / 0.5);
|
||||
--color-overlay: oklch(0 0 0 / 0.5);
|
||||
--color-shadow: oklch(0.18 0.02 270 / 0.1);
|
||||
--color-highlight: oklch(0.775 0.14 280 / 0.4);
|
||||
--color-divider: var(--color-lavender-100);
|
||||
|
||||
--color-term-close: oklch(60.176% 0.19209 25.037);
|
||||
--color-term-maximize: oklch(79.268% 0.17097 70.665);
|
||||
--color-term-minimize: oklch(65.072% 0.18112 143.77);
|
||||
}
|
||||
|
||||
/*
|
||||
================================================================
|
||||
DARK THEME OVERRIDES
|
||||
================================================================
|
||||
*/
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
:root {
|
||||
--color-primary: var(--color-lavender-300);
|
||||
--color-primary-variant: var(--color-lavender-400);
|
||||
--color-secondary: oklch(0.7 0.14 170);
|
||||
|
||||
Reference in New Issue
Block a user