From 40a5c7a5c53171f529e5e306cc3c918885cd6d3a Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 3 Jun 2024 11:56:01 +0800 Subject: [PATCH 1/2] Add project initialGlobals and deprecate globals --- src/story.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/story.ts b/src/story.ts index 7d4c97a..bec5ee7 100644 --- a/src/story.ts +++ b/src/story.ts @@ -390,7 +390,11 @@ export type ProjectAnnotations< > = BaseAnnotations & { argsEnhancers?: ArgsEnhancer[]; argTypesEnhancers?: ArgTypesEnhancer[]; + /** + * @deprecated Project `globals` renamed to `initiaGlobals` + */ globals?: Globals; + initialGlobals?: Globals; globalTypes?: GlobalTypes; applyDecorators?: DecoratorApplicator; runStep?: StepRunner; From 6fb63cdb857deee5dbd42be5137aaa718935e531 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 3 Jun 2024 12:15:55 +0800 Subject: [PATCH 2/2] Add globals annotation to component/story --- src/story.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/story.ts b/src/story.ts index bec5ee7..df41a93 100644 --- a/src/story.ts +++ b/src/story.ts @@ -494,6 +494,11 @@ export interface ComponentAnnotations; + + /** + * Override the globals values for all stories in this component + */ + globals?: Globals; } export type StoryAnnotations< @@ -516,6 +521,11 @@ export type StoryAnnotations< */ play?: PlayFunction; + /** + * Override the globals values for this story + */ + globals?: Globals; + /** @deprecated */ story?: Omit, 'story'>; // eslint-disable-next-line @typescript-eslint/ban-types