Skip to content

Commit

Permalink
slot/children for layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm authored Nov 11, 2024
1 parent 9cbaa15 commit 568e2d5
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ const defaultScriptTemplate = `
/** @type {import('./$types').LayoutData} */
export let data;
</script>
<slot />
`;

const tsSv5ScriptTemplate = `
<script lang="ts">
import type { Snippet } from 'svelte';
import type { LayoutData } from './$types';
let { data }: { data: LayoutData } = $props();
let { data, children }: { data: LayoutData, children: Snippet } = $props();
</script>
{@render children()}
`;

const tsScriptTemplate = `
Expand All @@ -21,13 +26,17 @@ const tsScriptTemplate = `
export let data: LayoutData;
</script>
<slot />
`;

const jsSv5ScriptTemplate = `
<script>
/** @type {{ data: import('./$types').LayoutData }} */
let { data } = $props();
/** @type {{ data: import('./$types').LayoutData, children: import('svelte').Snippet }} */
let { data, children } = $props();
</script>
{@render children()}
`;

const scriptTemplate: ReadonlyMap<ProjectType, string> = new Map([
Expand Down

0 comments on commit 568e2d5

Please sign in to comment.