Skip to content

Commit

Permalink
Merge pull request #100 from ComponentDriven/kasper/mount
Browse files Browse the repository at this point in the history
Add mount to CSF
  • Loading branch information
kasperpeulen authored Jul 2, 2024
2 parents ed816ed + 877a297 commit bdaeaf3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ export interface Renderer {
/** What type of element does this renderer render to? */
canvasElement: unknown;

mount(): Promise<Canvas>;

// A generic type T that can be used in the definition of the component like this:
// component: (args: this['T']) => string;
// This generic type will eventually be filled in with TArgs
Expand Down Expand Up @@ -275,6 +277,7 @@ export interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Arg
step: StepFunction<TRenderer, TArgs>;
context: this;
canvas: Canvas;
mount: TRenderer['mount'];
}

/** @deprecated Use {@link StoryContext} instead. */
Expand Down Expand Up @@ -387,6 +390,8 @@ export interface BaseAnnotations<TRenderer extends Renderer = Renderer, TArgs =
* Named tags for a story, used to filter stories in different contexts.
*/
tags?: Tag[];

mount?: (context: StoryContext<TRenderer, TArgs>) => TRenderer['mount'];
}

export interface ProjectAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args>
Expand Down

0 comments on commit bdaeaf3

Please sign in to comment.