From 6a16b9ce0f98babae42d245c3af6655e23eff8e2 Mon Sep 17 00:00:00 2001 From: xeho91 Date: Thu, 23 May 2024 17:13:00 +0800 Subject: [PATCH] Change `setTemplate` to use `typeof Story` --- src/components/Story.svelte | 19 +++++++++---------- src/components/StoryRenderer.svelte | 14 +++++++------- src/components/context.svelte.ts | 16 ++++++++++------ src/index.ts | 11 ++++++++--- stories/Example.stories.svelte | 6 +++--- stories/templates.stories.svelte | 8 ++++---- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/components/Story.svelte b/src/components/Story.svelte index 6e83d08..662de31 100644 --- a/src/components/Story.svelte +++ b/src/components/Story.svelte @@ -1,12 +1,11 @@ -{#snippet render(args: TArgs, context: TContext)} +{#snippet render(args: Args, context: StoryContext)}

{context.name}

You clicked: {count}
diff --git a/stories/templates.stories.svelte b/stories/templates.stories.svelte index f03ecc9..c858661 100644 --- a/stories/templates.stories.svelte +++ b/stories/templates.stories.svelte @@ -1,5 +1,5 @@ -{#snippet template1(args: TArgs)} +{#snippet template1(args: Args)}

Template 1

{args?.text}

{/snippet} -{#snippet template2(args: TArgs)} +{#snippet template2(args: Args)}

Template 2


{args?.text}