Show the engine setup until the browser engine is installed

A browser tab shows the download size, Download the engine, Install from
file, and Open in default browser until the engine can start. It shows
progress, Cancel, the cause of a failure, and Retry, and then opens the
page. Settings -> Browser shows the engine state and Remove engine. Web
links open in the system browser until the engine is installed. Open
link in app browser always opens a browser tab.
This commit is contained in:
Knotty Wyvern
2026-10-29 01:18:21 -07:00
parent 6004e126f7
commit c06d48f250
19 changed files with 425 additions and 107 deletions
+14 -5
View File
@@ -1,21 +1,30 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { onMount } from 'svelte';
import Icon from '$lib/ui/Icon.svelte';
import IconButton from '$lib/ui/IconButton.svelte';
import { state as browserState, request } from './client';
import { engine, engineReady } from './engine';
let { open }: { open: (profileId: string, url: string) => Promise<void> } = $props();
let error = $state('');
onMount(() => { void request('state').catch(reason => error = String(reason)); });
// The bookmarks live in the engine. A missing engine is not started here.
const installed = $derived(engineReady($engine));
let loaded = false;
$effect(() => {
if (!installed) { loaded = false; return; }
if (loaded) return;
loaded = true;
void request('state').catch(reason => error = String(reason));
});
</script>
<div class="bookmarks">
{#if error}<p role="alert">{error}</p>{/if}
{#each $browserState?.bookmarks || [] as item (item.id)}
{#if !installed}<p class="note">{$t("Install the browser engine to see the browser bookmarks.")}</p>{/if}
{#if error}<p class="error" role="alert">{error}</p>{/if}
{#each installed ? $browserState?.bookmarks || [] : [] as item (item.id)}
<div class="row"><button class="link" title={item.url} onclick={() => void open(item.profileId, item.url)}><Icon icon="globe" /><span>{item.title}</span></button><IconButton icon="close" label={`Remove ${item.title}`} onclick={() => void request('removeBookmark', { id: item.id })} /></div>
{/each}
</div>
<style>
.bookmarks{color:var(--rs-text);font-family:var(--rs-font-ui)}.row{display:flex;align-items:center;padding:0 5px;border-radius:var(--rs-control-radius)}.row:hover{background:var(--rs-bg-active)}
.link{display:flex;align-items:center;gap:8px;flex:1;min-width:0;padding:7px 5px;border:0;border-radius:var(--rs-control-radius);color:inherit;background:transparent;text-align:left;cursor:pointer}
span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link:focus-visible{outline:2px solid var(--rs-focus)}p{color:var(--rs-error);padding:8px;font-size:12px}
span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link:focus-visible{outline:2px solid var(--rs-focus)}p{padding:8px;font-size:12px}.error{color:var(--rs-error)}.note{margin:0;color:var(--rs-text-dim)}
</style>