chore: move some more components to svelte 5
Some checks failed
Deploy to GitHub Pages / build_site (push) Has been cancelled

This commit is contained in:
Max Richter
2025-11-23 19:35:33 +01:00
parent 716df245ab
commit 6ca1ff2a34
25 changed files with 470 additions and 550 deletions

View File

@@ -1,27 +1,33 @@
<script lang="ts">
import { setContext, getContext } from "svelte";
import localStore from "$lib/helpers/localStore";
import { localState } from "$lib/helpers/localState.svelte";
const gridId = getContext<string>("grid-id") || "grid-0";
let sizes = localStore<string[]>(gridId, []);
let sizes = localState<string[]>(gridId, []);
const { children } = $props();
console.log("RowChildren", children);
let registerIndex = 0;
setContext("registerCell", function () {
let index = registerIndex;
registerIndex++;
if (registerIndex > $sizes.length) {
$sizes = [...$sizes, "1fr"];
if (registerIndex > sizes.length) {
sizes = [...sizes, "1fr"];
}
return index;
});
setContext("sizes", sizes);
$: cols = $sizes.map((size, i) => `${i > 0 ? "1px " : ""}` + size).join(" ");
const cols = $derived(
sizes.map((size, i) => `${i > 0 ? "1px " : ""}` + size).join(" "),
);
</script>
<div class="wrapper" style={`grid-template-columns: ${cols};`}>
<slot />
{@render children()}
</div>
<style>