-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
… context entries to store args and global context during rendertime
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,15 @@ | |
* @component | ||
* @wrapper | ||
*/ | ||
import { createRenderContext } from './context'; | ||
import { tick } from 'svelte'; | ||
import { createRenderContext, setStoryRenderContext } from './context'; | ||
export let Stories; | ||
let exporttime = 0; | ||
export let args = {}; | ||
export let storyContext = {}; | ||
$: { | ||
createRenderContext($$props); | ||
} | ||
createRenderContext($$props); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
leika
Author
Contributor
|
||
$: setStoryRenderContext(args, storyContext); | ||
</script> | ||
|
||
{#key $$props.args} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
leika
Author
Contributor
|
||
<svelte:component this={Stories} /> | ||
{/key} | ||
<svelte:component this={Stories} /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
<script> | ||
import { useContext } from './context'; | ||
import { useContext, getStoryRenderContext } from './context'; | ||
const context = useContext(); | ||
export let id = 'default'; | ||
context.register({id, isTemplate: true}); | ||
context.register({ id, isTemplate: true }); | ||
$: render = context.render && context.templateId === id; | ||
const ctx = getStoryRenderContext(); | ||
const args = ctx.argsStore; | ||
const storyContext = ctx.storyContextStore; | ||
</script> | ||
|
||
{#if render} | ||
<slot {...context.args} context={context.storyContext} args={context.args}/> | ||
<slot {...$args} context={$storyContext} args={$args} /> | ||
{/if} |
does this maybe need to be reactive?