first commit

This commit is contained in:
valerio
2026-03-09 20:15:49 +01:00
commit 92732c20c9
58 changed files with 10602 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
// Tauri doesn't have a Node.js server to do proper SSR
// so we will use adapter-static to prerender the app (SSG)
// See: https://v2.tauri.app/start/frontend/sveltekit/ for more info
export const prerender = true;
export const ssr = false;
+5
View File
@@ -0,0 +1,5 @@
<script>
import '../app.css';
</script>
<slot></slot>
+203
View File
@@ -0,0 +1,203 @@
<script>
import '@webtui/css/components/spinner.css';
import { fade } from 'svelte/transition';
import { onMount } from 'svelte';
import { getSettings, currentSettings } from '$lib/settings.js';
import { getBlenderReleases, blenderReleases } from '$lib/blenderfetch';
import { getInstalledVersions, currentInstalledVersions } from '$lib/library.js';
import { downloadTasksStore } from '$lib/download.js';
import Library from '$lib/components/Library.svelte';
import Download from '$lib/components/Download.svelte';
import Settings from '$lib/components/Settings.svelte';
let fadeInSettings = { duration: 100 };
let fadeOutSettings = { duration: 100, delay: fadeInSettings.duration };
let activeTab = 'library';
let blenderVersions = [];
let installedVersions = [];
let downloadTasks = [];
let settings = {};
let initialized = false;
function initStoresListeners() {
currentSettings.subscribe((value) => {
settings = value;
console.log('Loaded settings:', settings);
});
currentInstalledVersions.subscribe((value) => {
installedVersions = value;
console.log('Loaded installed versions:', installedVersions);
});
blenderReleases.subscribe((value) => {
blenderVersions = value;
console.log('Loaded Blender releases:', blenderVersions);
});
downloadTasksStore.subscribe((value) => {
downloadTasks = value;
//console.log('Loaded download tasks:', downloadTasks);
});
}
onMount(async () => {
const startTime = Date.now();
await getSettings();
await getBlenderReleases();
await getInstalledVersions();
initStoresListeners();
const elapsed = Date.now() - startTime;
if (elapsed < 2000) {
initialized = true;
/* setTimeout(() => {
initialized = true;
}, 2000 - elapsed);*/
} else {
initialized = true;
}
//await getInstalledVersions();
//
});
</script>
<div id="main">
{#if initialized}
<div class="tablist" role="tablist">
<div
role="tab"
tabindex="0"
class="tabitem"
class:selected={activeTab === 'library'}
aria-selected={activeTab === 'library'}
on:click={() => (activeTab = 'library')}
on:keydown={(e) => (e.key === 'Enter' || e.key === ' ' ? (activeTab = 'library') : null)}
>
Library
</div>
<div
role="tab"
tabindex="0"
class="tabitem"
class:selected={activeTab === 'download'}
aria-selected={activeTab === 'download'}
on:click={() => (activeTab = 'download')}
on:keydown={(e) => (e.key === 'Enter' || e.key === ' ' ? (activeTab = 'download') : null)}
>
Download
</div>
<div
role="tab"
tabindex="0"
class="tabitem"
class:selected={activeTab === 'settings'}
aria-selected={activeTab === 'settings'}
on:click={() => (activeTab = 'settings')}
on:keydown={(e) => (e.key === 'Enter' || e.key === ' ' ? (activeTab = 'settings') : null)}
>
Settings
</div>
</div>
<div id="tabcontent">
<div class="frame">
{#if activeTab === 'library'}
<div class="page" in:fade={fadeOutSettings} out:fade={fadeInSettings}>
<Library {installedVersions} />
</div>
{:else if activeTab === 'download'}
<div class="page" in:fade={fadeOutSettings} out:fade={fadeInSettings}>
<Download {downloadTasks} {installedVersions} {blenderVersions} />
</div>
{:else if activeTab === 'settings'}
<div class="page" in:fade={fadeOutSettings} out:fade={fadeInSettings}>
<Settings {settings} />
</div>
{/if}
</div>
</div>
{:else}
LOADING...
{/if}
</div>
<style>
:global(:root) {
--white: #f5f5f5;
--light-accent: #d4cdf2;
--light: #eaebed;
--black: #171a21;
--accent: #7d70ba;
--error: #ed1c24;
--warning: #f1d302;
--font: font-family: 'Europa Mono', monospace;
}
:global(*) {
color: var(--black);
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
:global(.svelte-tabs) {
box-sizing: border-box;
padding: 0;
margin: 0;
gap: 0;
}
:global(body) {
box-sizing: border-box;
padding: 0;
margin: 0;
background-color: var(--white);
}
.tablist {
width: 100%;
height: 3rem;
display: flex;
flex-direction: row;
}
.tabitem {
text-align: center;
line-height: 3rem;
color: var(--black);
width: 8rem;
cursor: pointer;
padding: 0 1.5rem;
}
.tabitem:hover {
background-color: var(--light-accent);
}
.tabitem.selected {
background-color: var(--light-accent);
border-bottom: 2px solid var(--accent);
}
#main {
display: flex;
flex-direction: column;
}
#tabcontent {
background-color: var(--light);
box-sizing: border-box;
height: calc(100vh - 3rem);
padding: 1rem;
max-height: 100%;
}
.frame {
background-color: var(--white);
padding: 1rem;
height: 100%;
border-radius: 0.5rem;
max-height: 100%;
overflow-y: scroll;
}
.page {
display: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>