Skip to content

Commit fa77c25

Browse files
authored
Merge pull request #92 from ComponentDriven/shilman/initial-globals
Add project initialGlobals & component/story globals, deprecate project globals
2 parents 81a58c9 + 6fb63cd commit fa77c25

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/story.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ export type ProjectAnnotations<
390390
> = BaseAnnotations<TRenderer, TArgs> & {
391391
argsEnhancers?: ArgsEnhancer<TRenderer, Args>[];
392392
argTypesEnhancers?: ArgTypesEnhancer<TRenderer, Args>[];
393+
/**
394+
* @deprecated Project `globals` renamed to `initiaGlobals`
395+
*/
393396
globals?: Globals;
397+
initialGlobals?: Globals;
394398
globalTypes?: GlobalTypes;
395399
applyDecorators?: DecoratorApplicator<TRenderer, Args>;
396400
runStep?: StepRunner<TRenderer, TArgs>;
@@ -490,6 +494,11 @@ export interface ComponentAnnotations<TRenderer extends Renderer = Renderer, TAr
490494
* Function that is executed after the story is rendered.
491495
*/
492496
play?: PlayFunction<TRenderer, TArgs>;
497+
498+
/**
499+
* Override the globals values for all stories in this component
500+
*/
501+
globals?: Globals;
493502
}
494503

495504
export type StoryAnnotations<
@@ -512,6 +521,11 @@ export type StoryAnnotations<
512521
*/
513522
play?: PlayFunction<TRenderer, TArgs>;
514523

524+
/**
525+
* Override the globals values for this story
526+
*/
527+
globals?: Globals;
528+
515529
/** @deprecated */
516530
story?: Omit<StoryAnnotations<TRenderer, TArgs>, 'story'>;
517531
// eslint-disable-next-line @typescript-eslint/ban-types

0 commit comments

Comments
 (0)