Update to svelte 5
This commit is contained in:
parent
82bf565ce3
commit
007246da68
14 changed files with 710 additions and 699 deletions
37
package.json
37
package.json
|
@ -10,28 +10,29 @@
|
||||||
"tauri": "tauri"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
"@fortawesome/fontawesome-svg-core": "^6.6.0",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.5.2",
|
"@fortawesome/free-brands-svg-icons": "^6.6.0",
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.5.2",
|
"@fortawesome/free-regular-svg-icons": "^6.6.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
||||||
"@tauri-apps/api": "^1.5.6"
|
"@tauri-apps/api": "^2.0.3",
|
||||||
|
"@tauri-apps/plugin-shell": "~2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@skeletonlabs/skeleton": "^2.10.2",
|
"@skeletonlabs/skeleton": "^2.10.2",
|
||||||
"@skeletonlabs/tw-plugin": "^0.3.1",
|
"@skeletonlabs/tw-plugin": "^0.3.1",
|
||||||
"@sveltejs/adapter-auto": "^3.2.1",
|
"@sveltejs/adapter-auto": "^3.3.0",
|
||||||
"@sveltejs/adapter-static": "^3.0.1",
|
"@sveltejs/adapter-static": "^3.0.5",
|
||||||
"@sveltejs/kit": "2.5.26",
|
"@sveltejs/kit": "^2.7.2",
|
||||||
"@sveltejs/vite-plugin-svelte": "4.0.0-next.7",
|
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||||
"@tauri-apps/cli": "^1.5.14",
|
"@tauri-apps/cli": "^2.0.4",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.20",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.47",
|
||||||
"postcss-load-config": "^5.1.0",
|
"postcss-load-config": "^5.1.0",
|
||||||
"svelte": "5.0.0-next.244",
|
"svelte": "^5.0.5",
|
||||||
"svelte-check": "^3.7.1",
|
"svelte-check": "^4.0.0",
|
||||||
"svelte-fa": "^4.0.2",
|
"svelte-fa": "^4.0.3",
|
||||||
"tailwindcss": "^3.4.3",
|
"tailwindcss": "^3.4.14",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.6.3",
|
||||||
"vite": "^5.4.3"
|
"vite": "^5.4.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
892
pnpm-lock.yaml
892
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
||||||
import { RangeSlider, Tab, TabGroup, InputChip, SlideToggle } from '@skeletonlabs/skeleton';
|
import { RangeSlider, Tab, TabGroup, InputChip, SlideToggle } from '@skeletonlabs/skeleton';
|
||||||
import { imageGridColumns, postGridPreviewQuality, blacklist, limitImageHeight } from '$lib/settings';
|
import { imageGridColumns, postGridPreviewQuality, blacklist, limitImageHeight } from '$lib/settings';
|
||||||
|
|
||||||
let tabPos = 0;
|
let tabPos = $state(0);
|
||||||
let showApikey = false;
|
let showApikey = $state(false);
|
||||||
let apikey = '';
|
let apikey = $state('');
|
||||||
</script>
|
</script>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<h2 class="h2 mb-2 text-dark-token">Settings</h2>
|
<h2 class="h2 mb-2 text-dark-token">Settings</h2>
|
||||||
|
@ -14,7 +14,8 @@
|
||||||
<Tab class="text-dark-token" bind:group={tabPos} name="tab3" value={2}>User</Tab>
|
<Tab class="text-dark-token" bind:group={tabPos} name="tab3" value={2}>User</Tab>
|
||||||
<Tab class="text-dark-token" bind:group={tabPos} name="tab4" value={3}>Chats</Tab>
|
<Tab class="text-dark-token" bind:group={tabPos} name="tab4" value={3}>Chats</Tab>
|
||||||
|
|
||||||
<svelte:fragment slot="panel">
|
{#snippet panel()}
|
||||||
|
|
||||||
{#if tabPos === 0}
|
{#if tabPos === 0}
|
||||||
<div class="flex flex-col gap-3">
|
<div class="flex flex-col gap-3">
|
||||||
<h3 class="h3 text-dark-token font-bold">Image</h3>
|
<h3 class="h3 text-dark-token font-bold">Image</h3>
|
||||||
|
@ -83,6 +84,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</svelte:fragment>
|
|
||||||
|
{/snippet}
|
||||||
</TabGroup>
|
</TabGroup>
|
||||||
</div>
|
</div>
|
|
@ -3,8 +3,14 @@ import {faArrowLeft} from '@fortawesome/free-solid-svg-icons';
|
||||||
import {Fa} from 'svelte-fa';
|
import {Fa} from 'svelte-fa';
|
||||||
import {AppRailAnchor} from '@skeletonlabs/skeleton';
|
import {AppRailAnchor} from '@skeletonlabs/skeleton';
|
||||||
|
|
||||||
export let popCount = 1;
|
/**
|
||||||
let href;
|
* @typedef {Object} Props
|
||||||
|
* @property {number} [popCount]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Props} */
|
||||||
|
let { popCount = 1 } = $props();
|
||||||
|
let href = $state();
|
||||||
let pathnameParts = window.location.pathname.split('/');
|
let pathnameParts = window.location.pathname.split('/');
|
||||||
|
|
||||||
for(let i = 0; i < popCount; i++) {
|
for(let i = 0; i < popCount; i++) {
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { preventDefault } from 'svelte/legacy';
|
||||||
|
|
||||||
import { showSearch, loading } from '$lib/stores';
|
import { showSearch, loading } from '$lib/stores';
|
||||||
import { lastSearch } from '$lib/settings';
|
import { lastSearch } from '$lib/settings';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
let searchValue = $lastSearch;
|
let searchValue = $state($lastSearch);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $showSearch}
|
{#if $showSearch}
|
||||||
<form class="flex flex-row gap-2"
|
<form class="flex flex-row gap-2"
|
||||||
on:submit|preventDefault={() => {
|
onsubmit={preventDefault(() => {
|
||||||
$loading = true;
|
$loading = true;
|
||||||
goto('/')
|
goto('/')
|
||||||
lastSearch.set(searchValue);
|
lastSearch.set(searchValue);
|
||||||
}}>
|
})}>
|
||||||
<input class="input py-1 px-2 w-96" type="text" placeholder="Search" bind:value={searchValue} />
|
<input class="input py-1 px-2 w-96" type="text" placeholder="Search" bind:value={searchValue} />
|
||||||
<button class="btn btn-md variant-filled" type="submit">Submit</button>
|
<button class="btn btn-md variant-filled" type="submit">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
import { showSearch, loading } from '$lib/stores';
|
import { showSearch, loading } from '$lib/stores';
|
||||||
import { postGridPreviewQuality, imageGridColumns } from '$lib/settings';
|
import { postGridPreviewQuality, imageGridColumns } from '$lib/settings';
|
||||||
|
|
||||||
export let posts = [];
|
let { posts = [] } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="grid gap-3" style={`grid-template-columns: repeat(${$imageGridColumns}, minmax(0, 1fr))`}>
|
<div class="grid gap-3" style={`grid-template-columns: repeat(${$imageGridColumns}, minmax(0, 1fr))`}>
|
||||||
{#each posts as post}
|
{#each posts as post}
|
||||||
<a href={`/posts/${post.id}`} class="card p-3 flex flex-col justify-end items-center" on:click={() => {
|
<a href={`/posts/${post.id}`} class="card p-3 flex flex-col justify-end items-center" onclick={() => {
|
||||||
$loading = true;
|
$loading = true;
|
||||||
$showSearch = false
|
$showSearch = false
|
||||||
}}>
|
}}>
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
import { limitImageHeight } from '$lib/settings';
|
import { limitImageHeight } from '$lib/settings';
|
||||||
|
|
||||||
export let post = null;
|
/**
|
||||||
|
* @typedef {Object} Props
|
||||||
|
* @property {any} [post]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Props} */
|
||||||
|
let { post = null } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if post?.preview?.has}
|
{#if post?.preview?.has}
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Props
|
||||||
|
* @property {import('svelte').Snippet} [children]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Props} */
|
||||||
|
let { children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="container mx-auto">
|
<div class="container mx-auto">
|
||||||
<p>Error</p>
|
<p>Error</p>
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
|
@ -3,6 +3,13 @@
|
||||||
import { Drawer, initializeStores, Modal, ProgressRadial, Toast } from '@skeletonlabs/skeleton';
|
import { Drawer, initializeStores, Modal, ProgressRadial, Toast } from '@skeletonlabs/skeleton';
|
||||||
import { loading } from '$lib/stores';
|
import { loading } from '$lib/stores';
|
||||||
import { AppSettings } from '$lib/components';
|
import { AppSettings } from '$lib/components';
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Props
|
||||||
|
* @property {import('svelte').Snippet} [children]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Props} */
|
||||||
|
let { children } = $props();
|
||||||
|
|
||||||
initializeStores();
|
initializeStores();
|
||||||
</script>
|
</script>
|
||||||
|
@ -20,5 +27,5 @@
|
||||||
<ProgressRadial width="w-8" height="h-8" stroke={120} strokeLinecap="butt" />
|
<ProgressRadial width="w-8" height="h-8" stroke={120} strokeLinecap="butt" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
|
@ -1 +0,0 @@
|
||||||
export const ssr = false;
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { Fa } from 'svelte-fa';
|
import { Fa } from 'svelte-fa';
|
||||||
import { GlobalSearch, ImageGrid, SearchAppRailAnchor} from '$lib/components';
|
import { GlobalSearch, ImageGrid, SearchAppRailAnchor} from '$lib/components';
|
||||||
import { faGear } from '@fortawesome/free-solid-svg-icons';
|
import { faGear } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { invoke } from '@tauri-apps/api/tauri'
|
import { invoke } from '@tauri-apps/api/core'
|
||||||
import { lastSearch, blacklist } from '$lib/settings';
|
import { lastSearch, blacklist } from '$lib/settings';
|
||||||
import { postSearchResults, loading, showSearch} from '$lib/stores';
|
import { postSearchResults, loading, showSearch} from '$lib/stores';
|
||||||
import {
|
import {
|
||||||
|
@ -19,10 +19,10 @@
|
||||||
|
|
||||||
function onSearch() {
|
function onSearch() {
|
||||||
$loading = true;
|
$loading = true;
|
||||||
invoke('get_posts', { query: $lastSearch }).then((resPosts) => {
|
/*invoke('get_posts', { query: $lastSearch }).then((resPosts) => {
|
||||||
postSearchResults.set(new PostList(resPosts).filterPosts($blacklist).getPosts());
|
postSearchResults.set(new PostList(resPosts).filterPosts($blacklist).getPosts());
|
||||||
requestAnimationFrame(() => $loading = false);
|
requestAnimationFrame(() => $loading = false);
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,37 +38,47 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AppShell>
|
<AppShell>
|
||||||
<svelte:fragment slot="pageHeader">
|
{#snippet pageHeader()}
|
||||||
|
|
||||||
{#if $showSearch}
|
{#if $showSearch}
|
||||||
<AppBar>
|
<AppBar>
|
||||||
<GlobalSearch />
|
<GlobalSearch />
|
||||||
</AppBar>
|
</AppBar>
|
||||||
{/if}
|
{/if}
|
||||||
</svelte:fragment>
|
|
||||||
|
|
||||||
<svelte:fragment slot="sidebarLeft">
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet sidebarLeft()}
|
||||||
|
|
||||||
<div class="h-dvh">
|
<div class="h-dvh">
|
||||||
<AppRail>
|
<AppRail>
|
||||||
<svelte:fragment slot="lead">
|
{#snippet lead()}
|
||||||
|
|
||||||
<SearchAppRailAnchor />
|
<SearchAppRailAnchor />
|
||||||
</svelte:fragment>
|
|
||||||
<svelte:fragment slot="trail">
|
{/snippet}
|
||||||
|
{#snippet trail()}
|
||||||
|
|
||||||
<AppRailAnchor on:click={() => drawerStore.open()}>
|
<AppRailAnchor on:click={() => drawerStore.open()}>
|
||||||
<div class="flex flex-col gap-2 place-content-center">
|
<div class="flex flex-col gap-2 place-content-center">
|
||||||
<Fa size={'2x'} icon={faGear} />
|
<Fa size={'2x'} icon={faGear} />
|
||||||
<p>Settings</p>
|
<p>Settings</p>
|
||||||
</div>
|
</div>
|
||||||
</AppRailAnchor>
|
</AppRailAnchor>
|
||||||
</svelte:fragment>
|
|
||||||
|
{/snippet}
|
||||||
</AppRail>
|
</AppRail>
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment>
|
|
||||||
|
|
||||||
<svelte:fragment>
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet children()}
|
||||||
|
|
||||||
<div class="overflow-scroll p-2">
|
<div class="overflow-scroll p-2">
|
||||||
{#if $postSearchResults}
|
{#if $postSearchResults}
|
||||||
<ImageGrid posts={$postSearchResults} />
|
<ImageGrid posts={$postSearchResults} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment>
|
|
||||||
|
{/snippet}
|
||||||
</AppShell>
|
</AppShell>
|
|
@ -1,5 +1,3 @@
|
||||||
export const ssr = false;
|
|
||||||
|
|
||||||
/** @type {import('./$types').PageLoad} */
|
/** @type {import('./$types').PageLoad} */
|
||||||
export async function load({ params }) {
|
export async function load({ params }) {
|
||||||
return { postId: params.post_id };
|
return { postId: params.post_id };
|
||||||
|
|
|
@ -14,15 +14,15 @@
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { loading, showSearch } from '$lib/stores';
|
import { loading, showSearch } from '$lib/stores';
|
||||||
import { TAG_TYPES } from '$lib/Tags';
|
import { TAG_TYPES } from '$lib/Tags';
|
||||||
import { invoke } from '@tauri-apps/api/tauri';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
|
|
||||||
export let data;
|
let { data } = $props();
|
||||||
const drawerStore = getDrawerStore();
|
const drawerStore = getDrawerStore();
|
||||||
const tagTypes = Object.entries(TAG_TYPES);
|
const tagTypes = Object.entries(TAG_TYPES);
|
||||||
const toastStore = getToastStore();
|
const toastStore = getToastStore();
|
||||||
|
|
||||||
/** @type any|null */
|
/** @type any|null */
|
||||||
let post = null;
|
let post = $state(null);
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
$loading = true;
|
$loading = true;
|
||||||
|
@ -33,15 +33,18 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AppShell>
|
<AppShell>
|
||||||
<svelte:fragment slot="pageHeader">
|
{#snippet pageHeader()}
|
||||||
|
|
||||||
{#if $showSearch}
|
{#if $showSearch}
|
||||||
<AppBar>
|
<AppBar>
|
||||||
<GlobalSearch />
|
<GlobalSearch />
|
||||||
</AppBar>
|
</AppBar>
|
||||||
{/if}
|
{/if}
|
||||||
</svelte:fragment>
|
|
||||||
|
|
||||||
<svelte:fragment slot="sidebarRight">
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet sidebarRight()}
|
||||||
|
|
||||||
{#if post}
|
{#if post}
|
||||||
<div class="p-2 h-dvh">
|
<div class="p-2 h-dvh">
|
||||||
{#each tagTypes as [name, label]}
|
{#each tagTypes as [name, label]}
|
||||||
|
@ -54,19 +57,24 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</svelte:fragment>
|
|
||||||
|
|
||||||
<svelte:fragment slot="sidebarLeft">
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet sidebarLeft()}
|
||||||
|
|
||||||
<div class="h-dvh">
|
<div class="h-dvh">
|
||||||
<AppRail>
|
<AppRail>
|
||||||
<svelte:fragment slot="lead">
|
{#snippet lead()}
|
||||||
|
|
||||||
<BackAppRailAnchor popCount={2} />
|
<BackAppRailAnchor popCount={2} />
|
||||||
<SearchAppRailAnchor />
|
<SearchAppRailAnchor />
|
||||||
</svelte:fragment>
|
|
||||||
<svelte:fragment slot="trail">
|
{/snippet}
|
||||||
|
{#snippet trail()}
|
||||||
|
|
||||||
{#if post}
|
{#if post}
|
||||||
<AppRailAnchor>
|
<AppRailAnchor>
|
||||||
<button class="w-full flex flex-col gap-2 place-content-center place-items-center" on:click={() => toastStore.trigger({message: 'Copied link'})} use:clipboard={`https://e621.net/posts/${post.id}`}>
|
<button class="w-full flex flex-col gap-2 place-content-center place-items-center" onclick={() => toastStore.trigger({message: 'Copied link'})} use:clipboard={`https://e621.net/posts/${post.id}`}>
|
||||||
<Fa size={'2x'} icon={faCopy} />
|
<Fa size={'2x'} icon={faCopy} />
|
||||||
Copy link
|
Copy link
|
||||||
</button>
|
</button>
|
||||||
|
@ -78,12 +86,15 @@
|
||||||
Settings
|
Settings
|
||||||
</button>
|
</button>
|
||||||
</AppRailAnchor>
|
</AppRailAnchor>
|
||||||
</svelte:fragment>
|
|
||||||
|
{/snippet}
|
||||||
</AppRail>
|
</AppRail>
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment>
|
|
||||||
|
|
||||||
<svelte:fragment slot="default">
|
{/snippet}
|
||||||
|
|
||||||
|
{#snippet default()}
|
||||||
|
|
||||||
<div class="container mx-auto flex flex-col items-center justify-center">
|
<div class="container mx-auto flex flex-col items-center justify-center">
|
||||||
{#if post}
|
{#if post}
|
||||||
<div class="card mb-4 flex flex-col">
|
<div class="card mb-4 flex flex-col">
|
||||||
|
@ -131,7 +142,8 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment>
|
|
||||||
|
{/snippet}
|
||||||
</AppShell>
|
</AppShell>
|
||||||
|
|
||||||
<style lang="postcss"></style>
|
<style lang="postcss"></style>
|
||||||
|
|
|
@ -7,6 +7,8 @@ export default {
|
||||||
preprocess: [vitePreprocess({})],
|
preprocess: [vitePreprocess({})],
|
||||||
|
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter(),
|
adapter: adapter({
|
||||||
|
fallback: 'index.html'
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue