New look (not finished)
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
<div id="crt-vignette" class="crt-vignette" aria-hidden="true"></div>
|
||||
<!-- <div id="crt-vignette" class="crt-vignette" aria-hidden="true"></div> -->
|
||||
<div id="crt-scanlines" class="crt-scanlines" aria-hidden="true"></div>
|
||||
<div id="crt-grain" class="crt-grain" aria-hidden="true"></div>
|
||||
</body>
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
<script lang="ts">
|
||||
let { username, theme, windowCount, version, hash } = $props();
|
||||
let {
|
||||
username = $bindable(),
|
||||
theme = $bindable(),
|
||||
windowCount = $bindable(),
|
||||
windowTitle = $bindable(),
|
||||
version,
|
||||
hash
|
||||
}: {
|
||||
username: string;
|
||||
theme: string;
|
||||
windowCount: number;
|
||||
windowTitle: string;
|
||||
version: string;
|
||||
hash: string;
|
||||
} = $props();
|
||||
|
||||
// Internal clock — ticked every 30s so it doesn't go stale if mounted long.
|
||||
let now = $state(new Date());
|
||||
let init = new Date().getTime();
|
||||
let ms = $state(new Date().getTime());
|
||||
|
||||
function formatUptime(ms: number): string {
|
||||
const totalSec = Math.floor(ms / 1000);
|
||||
@@ -31,7 +43,7 @@
|
||||
{#snippet sep(cls: string = '')}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="text-bg3 text-[12px] leading-none {cls}"
|
||||
class="text-fg3 text-[9px] select-none {cls}"
|
||||
style="font-family:ui-monospace,monospace">·</span
|
||||
>
|
||||
{/snippet}
|
||||
@@ -47,18 +59,66 @@
|
||||
{/snippet}
|
||||
|
||||
<div
|
||||
class="bg-bg-soft text-fg3 border-bg3 grid w-full grid-cols-[auto_1fr_auto_auto_auto] gap-x-2 overflow-hidden rounded-b-lg border-t text-[11px]"
|
||||
class="bg-bg-soft text-fg3 border-bg3 font-system grid w-full grid-cols-[auto_1fr_auto] gap-x-3 rounded-b-lg border-t text-[11px] shadow-[inset_0_1px_0_rgba(255,255,255,0.04),0_-2px_0_0_rgba(0,0,0,0.1),0_-6px_20px_-4px_rgba(0,0,0,0.5)]"
|
||||
>
|
||||
<div
|
||||
class="col-span-full grid h-[22px] grid-cols-subgrid items-center px-[18px] shadow-[inset_0_-1px_0_var(--color-bg2)]"
|
||||
>
|
||||
<div class="flex items-center gap-1.5 justify-self-start">
|
||||
<button
|
||||
type="button"
|
||||
class="group hover:bg-bg1 -ml-1 flex h-[18px] items-center rounded px-1"
|
||||
aria-haspopup="menu"
|
||||
aria-expanded="false"
|
||||
>
|
||||
<span class="text-fg3 group-hover:text-fg2 text-[10.5px] font-medium whitespace-nowrap"
|
||||
>{username}</span
|
||||
>
|
||||
</button>
|
||||
{@render sep()}
|
||||
<span class="text-bg4 px-[3.5px] font-mono text-[9.5px] whitespace-nowrap">{uptime}</span>
|
||||
</div>
|
||||
|
||||
<span></span>
|
||||
|
||||
<time class="text-bg4 justify-self-end font-mono text-[9.5px] whitespace-nowrap">
|
||||
<span class="text-fg3 pr-2 font-medium">{weekday}</span><span>{time}</span>
|
||||
</time>
|
||||
</div>
|
||||
<div
|
||||
class="col-span-full grid h-[22px] grid-cols-subgrid items-center rounded-b-lg px-[18px] font-mono text-[9.5px] whitespace-nowrap"
|
||||
>
|
||||
<div class="flex items-center gap-1.5 justify-self-start">
|
||||
<span class="text-fg3">
|
||||
<span class="text-bg4">[</span><span class="font-medium">{windowCount.toString()}</span
|
||||
><span class="text-bg4">]</span>
|
||||
</span>
|
||||
{@render sep()}
|
||||
<span class="text-fg3">{windowTitle}</span>
|
||||
</div>
|
||||
|
||||
<span></span>
|
||||
|
||||
<span class="flex items-center gap-1.5 justify-self-end">
|
||||
<span class="text-fg3">{version}</span>
|
||||
{@render sep()}
|
||||
<span class="text-bg4">{hash}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div
|
||||
class="bg-bg-soft text-fg3 border-bg3 grid w-full zoom-115 grid-cols-[auto_1fr_auto_auto_auto] gap-x-2 overflow-hidden rounded-b-lg border-t text-[11px]"
|
||||
style="font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 -2px 0 0 rgba(0,0,0,0.1), 0 -6px 20px -4px rgba(0,0,0,0.5), 0 -16px 40px -12px rgba(0,0,0,0.65);"
|
||||
role="region"
|
||||
aria-label="System status bar"
|
||||
>
|
||||
<!-- Top row: user · theme · settings · time -->
|
||||
<div
|
||||
class="col-span-full grid h-[22px] grid-cols-subgrid items-center px-4.5 shadow-[inset_0_-1px_0_var(--bg2)]"
|
||||
>
|
||||
<div class="flex items-center gap-2 justify-self-end">
|
||||
<span aria-hidden="true" class="bg-tgreen h-1.25 w-1.25 shrink-0 rounded-full"></span>
|
||||
<span class="text-fg2 text-[10.5px] font-medium whitespace-nowrap">{username}</span>
|
||||
<span class="text-fg3 text-[10.5px] font-medium whitespace-nowrap">{username}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
@@ -74,8 +134,9 @@
|
||||
type="button"
|
||||
aria-label="Settings"
|
||||
class="text-bg4 flex h-5 w-5 shrink-0 items-center justify-center justify-self-end rounded border-0 bg-transparent p-0 text-[12px]"
|
||||
>⚙</button
|
||||
>
|
||||
<Cog color={'var(--fg1)'} size={8} />
|
||||
</button>
|
||||
|
||||
{@render sep('justify-self-center')}
|
||||
|
||||
@@ -84,12 +145,10 @@
|
||||
class="text-bg4 justify-self-start text-[9.5px] whitespace-nowrap"
|
||||
style="font-family:ui-monospace,monospace"
|
||||
>
|
||||
<span class="text-fg3 font-medium">{weekday}</span>
|
||||
<span class="text-fg4 font-medium">{weekday}</span>
|
||||
{time}
|
||||
</time>
|
||||
</div>
|
||||
|
||||
<!-- Bottom row: windows · shortcuts · build · uptime -->
|
||||
<div
|
||||
class="col-span-full grid h-[22px] grid-cols-subgrid items-center rounded-b-lg px-4.5 text-[9.5px] whitespace-nowrap"
|
||||
style="font-family:ui-monospace,monospace"
|
||||
@@ -115,4 +174,4 @@
|
||||
|
||||
<span class="text-bg4 justify-self-start">{uptime}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
hostname = $bindable(),
|
||||
working_dir = $bindable(),
|
||||
mwin = $bindable(),
|
||||
|
||||
close
|
||||
}: {
|
||||
id: number;
|
||||
@@ -40,7 +41,7 @@
|
||||
<Movable
|
||||
{wrapper}
|
||||
{mwinoptions}
|
||||
class="shadow-subtle flex size-full h-256 w-420 flex-col rounded-lg"
|
||||
class="shadow-subtle flex size-full h-128 w-210 flex-col rounded-lg"
|
||||
>
|
||||
<div
|
||||
id="terminal-bar"
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
/* ---------- palette tokens → Tailwind utilities ---------- */
|
||||
|
||||
@theme inline {
|
||||
--color-bg-full: var(--bg-full);
|
||||
--color-bg-hard: var(--bg-hard);
|
||||
--color-bg: var(--bg);
|
||||
--color-bg-soft: var(--bg-soft);
|
||||
@@ -34,6 +35,7 @@
|
||||
|
||||
:root,
|
||||
:root[data-theme='gruvbox'] {
|
||||
--bg-full: #0f1011;
|
||||
--bg-hard: #1d2021;
|
||||
--bg: #282828;
|
||||
--bg-soft: #32302f;
|
||||
|
||||
Reference in New Issue
Block a user