Bash and IO working, basic error setup. Changelog:

Commands:
    - ls (only with -l)
    - cd (basic, probably unfinished)
This commit is contained in:
2026-02-08 10:42:58 +01:00
committed by ChaosMaker
parent 4428cc7e8a
commit e853268e52
15 changed files with 775 additions and 441 deletions
+13 -26
View File
@@ -1,47 +1,34 @@
<script lang="ts">
let inputElement = $state<HTMLInputElement>();
let { value, isFocused, cwd }: { value?: string; isFocused?: boolean; cwd: string } = $props();
export function focus() {
console.log('WOOOOW');
inputElement?.focus();
}
export function blur() {
console.log('beeeeeeeee');
inputElement?.blur();
}
export function setValue(newValue: string) {
if (inputElement) {
inputElement.value = newValue;
}
}
export function clear() {
setValue('');
}
let {
inputValue = $bindable(),
isFocused,
cwd
}: { inputValue: string; isFocused?: boolean; cwd: string } = $props();
function handleInput(event: Event) {
value = (event.target as HTMLInputElement).value;
inputValue = (event.target as HTMLInputElement).value;
}
</script>
<div class=" relative">
<input
bind:this={inputElement}
bind:value={inputValue}
onkeydown={(e) => e.key === 'Enter' && (inputValue = '')}
oninput={handleInput}
onfocus={() => (isFocused = true)}
onblur={() => (isFocused = false)}
type="text"
autocapitalize="off"
autocomplete="off"
autocorrect="off"
class=" pointer-events-none absolute left-0 m-0 w-0 border-none p-0 opacity-0"
id="input"
/>
<p class="cwd" id="cwd">{cwd}</p>
<div class="w flex-column flex flex-row flex-wrap font-terminal">
<span class="pointer pr-2">$</span>
<!-- prettier-ignore -->
<div style="white-space: preserve;" class=" relative wrap-break-word">{value}</div>
<div style="white-space: preserve;" class=" relative wrap-break-word">{inputValue}</div>
<span id="cursor" class={isFocused ? 'animate-cursor-blink' : ''}>_</span>
</div>
</div>