feat(*): migrate to svelte 5 with bunx sv migrate

This commit is contained in:
mei (ckie) 2024-10-24 16:31:12 +03:00
parent 61b65cd2b8
commit 06db3533f0
Signed by untrusted user: ckie
GPG key ID: 13E79449C0525215
6 changed files with 31 additions and 25 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -13,21 +13,21 @@
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0", "@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0", "@sveltejs/kit": "^2.5.27",
"@sveltejs/vite-plugin-svelte": "^3.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"prettier": "^3.1.1", "prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2", "prettier-plugin-svelte": "^3.2.6",
"svelte": "^4.2.7", "svelte": "^5.0.0",
"svelte-check": "^4.0.0", "svelte-check": "^4.0.0",
"tailwindcss": "^3.4.11", "tailwindcss": "^3.4.11",
"typescript": "^5.0.0", "typescript": "^5.5.0",
"vite": "^5.0.3" "vite": "^5.4.4"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@sveltejs/enhanced-img": "^0.3.8", "@sveltejs/enhanced-img": "^0.3.9",
"svelte-highlight": "^7.7.0" "svelte-highlight": "^7.7.0"
} }
} }

View file

@ -1,16 +1,17 @@
<script> <script lang="ts">
import Highlight from "svelte-highlight"; import Highlight from "svelte-highlight";
import "$lib/hljs.css"; import "$lib/hljs.css";
export let language; let {
export let code; language,
export let slice = true; code,
export let alt; slice = $bindable(true),
alt
} = $props();
let renderedCode; let renderedCode = $derived(slice ? code.replace(/#<hidden>[^]*?#<\/hidden>/, "")
$: renderedCode = : code.replace(/#(<hidden>|<\/hidden>)/g,""));
slice ? code.replace(/#<hidden>[^]*?#<\/hidden>/, "")
: code.replace(/#(<hidden>|<\/hidden>)/g,"");
</script> </script>
<p class="sr-only">{alt}</p> <p class="sr-only">{alt}</p>
@ -21,7 +22,7 @@
<button <button
class="top-0 right-0 absolute font-sans text-xs font-bold" class="top-0 right-0 absolute font-sans text-xs font-bold"
class:text-blue-500={slice} class:text-blue-500={slice}
on:click={() => { slice = !slice }} onclick={() => { slice = !slice }}
> >
({slice ? "show" : "hide"} full) ({slice ? "show" : "hide"} full)
</button> </button>

View file

@ -1,7 +1,9 @@
<script> <script lang="ts">
import { page } from "$app/stores"; import { page } from "$app/stores";
import "../main.css"; import "../main.css";
import Footer from "./footer.svelte"; import Footer from "./footer.svelte";
let { children } = $props();
globalThis.PKGS = "petalpkgs"; globalThis.PKGS = "petalpkgs";
globalThis.DISTRO = "FleurixOS"; globalThis.DISTRO = "FleurixOS";
</script> </script>
@ -10,7 +12,7 @@
<title>floral.systems</title> <title>floral.systems</title>
<meta property="og:title" content="floral.systems" /> <meta property="og:title" content="floral.systems" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:url" content={$page.url} /> <meta property="og:url" content={$page.url?.toString()} />
<meta name="theme-color" content="#136951"> <meta name="theme-color" content="#136951">
</svelte:head> </svelte:head>
@ -39,7 +41,7 @@
<section class="Layout-content container w-full mx-auto"> <section class="Layout-content container w-full mx-auto">
<div class="m-1"> <div class="m-1">
<slot /> {@render children?.()}
</div> </div>
</section> </section>

View file

@ -1,14 +1,13 @@
<script lang="ts"> <script lang="ts">
export let colors; import Color from "./Color.svelte";
export let name; let { colors, name, path = [] } = $props();
export let path = [];
</script> </script>
{#if typeof colors[name] == "object"} {#if typeof colors[name] == "object"}
<h3 class="mb-0 text-xl text-center">{name}</h3> <h3 class="mb-0 text-xl text-center">{name}</h3>
<div class="p-4 grid gap-4 grid-cols-2 lg:grid-cols-4 xl:grid-cols-6 auto-rows-auto"> <div class="p-4 grid gap-4 grid-cols-2 lg:grid-cols-4 xl:grid-cols-6 auto-rows-auto">
{#each Object.keys(colors[name]) as n} {#each Object.keys(colors[name]) as n}
<svelte:self name={n} colors={colors[name]} path={[...path, name]} /> <Color name={n} colors={colors[name]} path={[...path, name]} />
{/each} {/each}
</div> </div>
<hr /> <hr />

View file

@ -1,3 +1,7 @@
<script lang="ts">
let { children } = $props();
</script>
<div class="Layout-docs-root flex max-xl:flex-col lg:gap-2 justify-around"> <div class="Layout-docs-root flex max-xl:flex-col lg:gap-2 justify-around">
<div class="grow xl:relative"> <div class="grow xl:relative">
<nav class="mt-12 xl:absolute lg:right-0"> <nav class="mt-12 xl:absolute lg:right-0">
@ -13,7 +17,7 @@
</ul> </ul>
</nav> </nav>
</div> </div>
<div class="Layout-docs-content max-w-[700px]"><slot /></div> <div class="Layout-docs-content max-w-[700px]">{@render children?.()}</div>
<div class="grow"></div> <div class="grow"></div>
</div> </div>