refactor
This commit is contained in:
3
TODO.md
3
TODO.md
@@ -1,3 +0,0 @@
|
|||||||
Change router to svelte-spa-router
|
|
||||||
Remove data directory
|
|
||||||
Build and update workflows
|
|
@@ -4,7 +4,7 @@
|
|||||||
"beforeBuildCommand": "pnpm svelte:build",
|
"beforeBuildCommand": "pnpm svelte:build",
|
||||||
"beforeDevCommand": "pnpm svelte:dev",
|
"beforeDevCommand": "pnpm svelte:dev",
|
||||||
"devPath": "http://localhost:5173",
|
"devPath": "http://localhost:5173",
|
||||||
"distDir": "../dist"
|
"distDir": "../build"
|
||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "svelte-tauri",
|
"productName": "svelte-tauri",
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
// Empty for now
|
|
||||||
</script>
|
|
@@ -1,10 +0,0 @@
|
|||||||
<script>
|
|
||||||
import { router } from 'tinro';
|
|
||||||
import { fade } from 'svelte/transition';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#key $router.path}
|
|
||||||
<div in:fade={{ duration: 700 }} class="h-full w-full">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
{/key}
|
|
@@ -1,41 +0,0 @@
|
|||||||
import type { NavLink } from '$types';
|
|
||||||
|
|
||||||
export const navLinks: NavLink[] = [
|
|
||||||
{
|
|
||||||
content: {
|
|
||||||
text: 'Home'
|
|
||||||
},
|
|
||||||
target: {
|
|
||||||
href: '/',
|
|
||||||
newTab: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
content: {
|
|
||||||
text: 'Call-Tauri'
|
|
||||||
},
|
|
||||||
target: {
|
|
||||||
href: '/call-tauri',
|
|
||||||
newTab: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
content: {
|
|
||||||
text: 'Hash-string'
|
|
||||||
},
|
|
||||||
target: {
|
|
||||||
href: '/hash-string',
|
|
||||||
newTab: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
content: {
|
|
||||||
text: 'Versions'
|
|
||||||
},
|
|
||||||
target: {
|
|
||||||
href: '/versions',
|
|
||||||
newTab: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
@@ -5,43 +5,52 @@
|
|||||||
import { faXmark, faWindowMinimize } from '@fortawesome/free-solid-svg-icons';
|
import { faXmark, faWindowMinimize } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faGithub } from '@fortawesome/free-brands-svg-icons';
|
import { faGithub } from '@fortawesome/free-brands-svg-icons';
|
||||||
import Fa from 'svelte-fa';
|
import Fa from 'svelte-fa';
|
||||||
import { navLinks } from '$data/NavLinks';
|
import { link } from 'svelte-spa-router';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header
|
<header
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
class="h-12 bg-base-100 shadow-lg items-center justify-between flex px-2"
|
class="flex h-12 items-center justify-between bg-base-100 px-2 shadow-lg">
|
||||||
>
|
<button
|
||||||
<button on:click={theme.toggleTheme} class="hover:text-secondary ml-2 grid">
|
tabindex="-1"
|
||||||
|
on:click={theme.toggleTheme}
|
||||||
|
class="flex items-center hover:text-secondary">
|
||||||
<ThemeToggleIcon theme={$theme} />
|
<ThemeToggleIcon theme={$theme} />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="flex space-x-4">
|
<ul class="flex space-x-4 text-xl font-bold">
|
||||||
{#each navLinks as navLink, i (i)}
|
<li>
|
||||||
<li>
|
<a use:link href="/" class="transition-colors hover:text-secondary">
|
||||||
<a
|
Home
|
||||||
href={navLink.target.href}
|
</a>
|
||||||
target={navLink.target.newTab ? '_blank' : ''}
|
</li>
|
||||||
class="hover:text-secondary transition-colors"
|
<li>
|
||||||
>
|
<a
|
||||||
{#if navLink.content.icon}
|
use:link
|
||||||
<Fa icon={navLink.content.icon} />
|
href="/#call_tauri"
|
||||||
{/if}
|
class="transition-colors hover:text-secondary">
|
||||||
{navLink.content.text}
|
Call Tauri
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
use:link
|
||||||
|
href="/#versions"
|
||||||
|
class="transition-colors hover:text-secondary">
|
||||||
|
Versions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="flex [&>*]:px-2 h-full [&>*]:transition-all">
|
<div class="flex h-full [&>*]:px-2 [&>*]:transition-all">
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/Fractal-Tess/Svelte-Tauri"
|
href="https://github.com/Fractal-Tess/Svelte-Tauri"
|
||||||
class="hover:text-secondary flex items-center"
|
class="flex items-center hover:text-secondary"
|
||||||
rel="noreferrer"
|
rel="noreferrer">
|
||||||
>
|
|
||||||
<Fa icon={faGithub} size="lg" />
|
<Fa icon={faGithub} size="lg" />
|
||||||
</a>
|
</a>
|
||||||
<button on:click={appWindow.minimize} class="text-xl hover:text-secondary">
|
<button on:click={appWindow.minimize} class="text-xl hover:text-secondary">
|
@@ -1,16 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
import Header from '$lib/components/header/Header.svelte';
|
import Header from '$layout/BaseHeader.svelte';
|
||||||
import Footer from '$lib/components/footer/Footer.svelte';
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div class="form-control min-h-screen bg-fixed heropattern-topography-white/10">
|
||||||
class="font-sans bg-base-100 text-base-content h-screen flex flex-col overflow-y-auto overflow-x-hidden"
|
|
||||||
>
|
|
||||||
<Header />
|
<Header />
|
||||||
<main class="flex-1" in:fade={{ delay: 300, duration: 1000 }}>
|
<main class="form-control flex-1" in:fade={{ delay: 300, duration: 1000 }}>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,19 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Route, router } from 'tinro';
|
import Router from 'svelte-spa-router';
|
||||||
router.mode.hash();
|
|
||||||
|
|
||||||
import Index from '$lib/router/routes/Index.svelte';
|
import Index from '$lib/router/routes/Index.svelte';
|
||||||
import CallTauri from '$router/routes/CallTauri.svelte';
|
import CallTauri from '$router/routes/CallTauri.svelte';
|
||||||
import HashString from '$router/routes/HashString.svelte';
|
|
||||||
import Versions from '$router/routes/Versions.svelte';
|
import Versions from '$router/routes/Versions.svelte';
|
||||||
import Transition from '$lib/components/transition/Transition.svelte';
|
|
||||||
|
const routes = {
|
||||||
|
'/': Index,
|
||||||
|
'/#call_tauri': CallTauri,
|
||||||
|
'/#versions': Versions
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Fix for linting errors: ->
|
<Router {routes} />
|
||||||
https://github.com/AlexxNB/tinro/pull/121/commits/d2251ffed630aac6e76e71856204ead5dd2f6661 -->
|
|
||||||
<Transition>
|
|
||||||
<Route path="/"><Index /></Route>
|
|
||||||
<Route path="/call-tauri"><CallTauri /></Route>
|
|
||||||
<Route path="/hash-string"><HashString /></Route>
|
|
||||||
<Route path="/versions"><Versions /></Route>
|
|
||||||
</Transition>
|
|
||||||
|
@@ -2,6 +2,12 @@
|
|||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { invoke } from '@tauri-apps/api';
|
import { invoke } from '@tauri-apps/api';
|
||||||
|
|
||||||
|
let hashInput = 'Hello world';
|
||||||
|
let hashOutput = '';
|
||||||
|
$: (async () => {
|
||||||
|
hashOutput = await invoke('hash256sum', { hashInput });
|
||||||
|
})();
|
||||||
|
|
||||||
let message = '';
|
let message = '';
|
||||||
|
|
||||||
async function callTauri() {
|
async function callTauri() {
|
||||||
@@ -9,20 +15,33 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="h-full flex flex-col items-center justify-center">
|
<div
|
||||||
<button
|
class="form-control h-full flex-1 items-center justify-center gap-y-8
|
||||||
on:click={callTauri}
|
[&>section]:form-control [&>section]:items-center [&>section]:justify-center [&>section]:gap-y-4">
|
||||||
class="font-extrabold btn btn-outline btn-primary btn-md">Call Tauri</button
|
<section class="">
|
||||||
>
|
<button
|
||||||
<div class="h-20 flex items-center">
|
on:click={callTauri}
|
||||||
{#key message}
|
class="btn-outline btn-primary btn-md btn font-extrabold"
|
||||||
<p
|
>Call Tauri</button>
|
||||||
class="border-b-2 border-accent text-2xl
|
<div class="flex h-20 items-center">
|
||||||
whitespace-nowrap"
|
{#key message}
|
||||||
in:fade={{ duration: 300 }}
|
<p
|
||||||
>
|
class="whitespace-nowrap border-b-2 border-accent
|
||||||
{message}
|
text-2xl"
|
||||||
</p>
|
in:fade={{ duration: 300 }}>
|
||||||
{/key}
|
{message}
|
||||||
</div>
|
</p>
|
||||||
|
{/key}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<label class="input-group flex max-w-max">
|
||||||
|
<span>Hash string</span>
|
||||||
|
<input
|
||||||
|
bind:value={hashInput}
|
||||||
|
type="text"
|
||||||
|
class="input-bordered input-secondary input focus:border-secondary focus:outline-none focus:ring-secondary" />
|
||||||
|
</label>
|
||||||
|
<p class="text-center text-lg">{hashOutput}</p>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { invoke } from '@tauri-apps/api';
|
|
||||||
|
|
||||||
let hashInput = 'Hello world';
|
|
||||||
let hashOutput = '';
|
|
||||||
$: (async () => {
|
|
||||||
hashOutput = await invoke('hash256sum', { hashInput });
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="h-full flex flex-col space-y-8 items-center justify-center">
|
|
||||||
<div class="form-control">
|
|
||||||
<label class="input-group">
|
|
||||||
<span>Hash string</span>
|
|
||||||
<input
|
|
||||||
bind:value={hashInput}
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered input-secondary focus:ring-secondary focus:border-secondary focus:outline-none"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<p class="text-center text-lg">{hashOutput}</p>
|
|
||||||
</div>
|
|
@@ -1,20 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import svelte_logo from '$assets/svelte_logo.svg';
|
|
||||||
import tauri_logo from '$assets/tauri_logo.svg';
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex flex-col space-y-6 items-center justify-center font-bold drop-shadow-ft h-full"
|
class="form-control flex-1 items-center justify-center space-y-6 text-center font-bold">
|
||||||
>
|
|
||||||
<h1 class="text-6xl">Welcome</h1>
|
<h1 class="text-6xl">Welcome</h1>
|
||||||
<h2 class="text-3xl flex items-center">
|
<h2 class="flex items-center text-3xl [&_img]:h-12">
|
||||||
This is a  
|
This is a  
|
||||||
<span>
|
<span>
|
||||||
<img src={svelte_logo} alt="svelte logo" class="h-12" />
|
<img src={'/svelte_logo.svg'} alt="svelte logo" />
|
||||||
</span>
|
</span>
|
||||||
 - 
|
 - 
|
||||||
<span>
|
<span>
|
||||||
<img src={tauri_logo} alt="svelte logo" class="h-12" />
|
<img src={'/tauri_logo.svg'} alt="svelte logo" />
|
||||||
</span>
|
</span>
|
||||||
  Template
|
  Template
|
||||||
</h2>
|
</h2>
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
const getVersions = async (): Promise<Versions> => {
|
const getVersions = async (): Promise<Versions> => {
|
||||||
const [tauri, app, name] = await Promise.all([
|
const [tauri, app, name] = await Promise.all([
|
||||||
|
getName(),
|
||||||
getTauriVersion(),
|
getTauriVersion(),
|
||||||
getVersion(),
|
getVersion()
|
||||||
getName()
|
|
||||||
]);
|
]);
|
||||||
return {
|
return {
|
||||||
tauri,
|
tauri,
|
||||||
@@ -21,15 +21,15 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="h-full flex flex-col space-y-8 items-center justify-center text-xl font-bold"
|
class="form-control flex-1 items-center justify-center space-y-8 text-2xl font-bold">
|
||||||
>
|
<h1 class="text-5xl text-primary">Versions</h1>
|
||||||
<h1 class="text-2xl">Versions</h1>
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="flex flex-col space-y-4">
|
<ul class="form-control space-y-4">
|
||||||
{#await getVersions() then versions}
|
{#await getVersions() then versions}
|
||||||
{#each Object.entries(versions) as [key, val], i (i)}
|
{#each Object.entries(versions) as [key, val]}
|
||||||
<li>
|
<li>
|
||||||
{key} - {val}
|
<span class="text-secondary"> {key}</span> -
|
||||||
|
<span class="text-primary"> {val}</span>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
{/await}
|
{/await}
|
||||||
|
@@ -8,16 +8,24 @@ html {
|
|||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
body,
|
|
||||||
html {
|
|
||||||
/* Fix tailwindcss/daisyUI applying color to the body tag */
|
|
||||||
background-color: transparent !important;
|
|
||||||
@apply rounded-3xl overflow-hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
@layer utilities {
|
@layer utilities {
|
||||||
/* Class is used for development purposes only */
|
/* Class is used for development purposes only */
|
||||||
.dev {
|
.dev {
|
||||||
border: 1px solid red;
|
@apply border-[1px];
|
||||||
|
}
|
||||||
|
.devo {
|
||||||
|
@apply outline outline-dashed outline-1 outline-primary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
input[type='number']::-webkit-inner-spin-button,
|
||||||
|
input[type='number']::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='number'] {
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
@@ -29,6 +29,7 @@ export default defineConfig({
|
|||||||
envPrefix: ['VITE_', 'TAURI_'],
|
envPrefix: ['VITE_', 'TAURI_'],
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
|
outDir: 'build',
|
||||||
target: ['es2021', 'chrome100', 'safari13'],
|
target: ['es2021', 'chrome100', 'safari13'],
|
||||||
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
|
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
|
||||||
sourcemap: !!process.env.TAURI_DEBUG
|
sourcemap: !!process.env.TAURI_DEBUG
|
||||||
|
Reference in New Issue
Block a user