Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add canvas prop to the context #99

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@storybook/eslint-config-storybook"
],
"rules": {
"@typescript-eslint/no-empty-interface": "off",
"import/no-unresolved": "error",
"jest/expect-expect": [
"warn",
Expand Down
15 changes: 7 additions & 8 deletions src/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ export type BeforeEach<TRenderer extends Renderer = Renderer, TArgs = Args> = (
context: StoryContext<TRenderer, TArgs>
) => Awaitable<CleanupCallback | void>;

export interface Canvas {}

export interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args>
extends StoryContextForEnhancers<TRenderer, TArgs>,
Required<StoryContextUpdate<TArgs>> {
Expand All @@ -270,19 +272,16 @@ export interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Arg
viewMode: ViewMode;
step: StepFunction<TRenderer, TArgs>;
context: this;
canvas: Canvas;
}

/** @deprecated Use {@link StoryContext} instead. */
export type StoryContextForLoaders<
TRenderer extends Renderer = Renderer,
TArgs = Args
> = StoryContext<TRenderer, TArgs>;
export interface StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args>
extends StoryContext<TRenderer, TArgs> {}

/** @deprecated Use {@link StoryContext} instead. */
export type PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContext<
TRenderer,
TArgs
>;
export interface PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Args>
extends StoryContext<TRenderer, TArgs> {}

export type StepLabel = string;

Expand Down
Loading