@storybook/csf 0.0.2--canary.48.3bd2bd7.0 → 0.0.2--canary.49.b089ae5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/story.d.ts CHANGED
@@ -64,10 +64,15 @@ export declare type StrictGlobalTypes = {
64
64
  export declare type AnyFramework = {
65
65
  component: unknown;
66
66
  storyResult: unknown;
67
+ T?: unknown;
67
68
  };
68
69
  export declare type StoryContextForEnhancers<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryIdentifier & {
69
- component?: TFramework['component'];
70
- subcomponents?: Record<string, TFramework['component']>;
70
+ component?: (TFramework & {
71
+ T: any;
72
+ })['component'];
73
+ subcomponents?: (TFramework & {
74
+ T: any;
75
+ })['component'];
71
76
  parameters: Parameters;
72
77
  initialArgs: TArgs;
73
78
  argTypes: StrictArgTypes<TArgs>;
@@ -99,7 +104,7 @@ export declare type PlayFunctionContext<TFramework extends AnyFramework = AnyFra
99
104
  step: StepFunction<TFramework, TArgs>;
100
105
  };
101
106
  export declare type PlayFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: PlayFunctionContext<TFramework, TArgs>) => Promise<void> | void;
102
- export declare type PartialStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (update?: StoryContextUpdate<TArgs>) => TFramework['storyResult'];
107
+ export declare type PartialStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TFramework['storyResult'];
103
108
  export declare type LegacyStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
104
109
  export declare type ArgsStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (args: TArgs, context: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
105
110
  export declare type StoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = LegacyStoryFn<TFramework, TArgs> | ArgsStoryFn<TFramework, TArgs>;
@@ -107,11 +112,11 @@ export declare type DecoratorFunction<TFramework extends AnyFramework = AnyFrame
107
112
  export declare type DecoratorApplicator<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (storyFn: LegacyStoryFn<TFramework, TArgs>, decorators: DecoratorFunction<TFramework, TArgs>[]) => LegacyStoryFn<TFramework, TArgs>;
108
113
  export declare type StepRunner<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (label: StepLabel, play: PlayFunction<TFramework, TArgs>, context: PlayFunctionContext<TFramework, TArgs>) => Promise<void>;
109
114
  export declare type BaseAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = {
110
- decorators?: DecoratorFunction<TFramework, Args>[];
115
+ decorators?: DecoratorFunction<TFramework, TArgs>[];
111
116
  parameters?: Parameters;
112
117
  args?: Partial<TArgs>;
113
118
  argTypes?: Partial<ArgTypes<TArgs>>;
114
- loaders?: LoaderFunction<TFramework, Args>[];
119
+ loaders?: LoaderFunction<TFramework, TArgs>[];
115
120
  render?: ArgsStoryFn<TFramework, TArgs>;
116
121
  };
117
122
  export declare type ProjectAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = BaseAnnotations<TFramework, TArgs> & {
@@ -123,20 +128,26 @@ export declare type ProjectAnnotations<TFramework extends AnyFramework = AnyFram
123
128
  runStep?: StepRunner<TFramework, TArgs>;
124
129
  };
125
130
  declare type StoryDescriptor = string[] | RegExp;
126
- export declare type ComponentAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = BaseAnnotations<TFramework, TArgs> & {
131
+ export interface ComponentAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> extends BaseAnnotations<TFramework, TArgs> {
127
132
  title?: ComponentTitle;
128
133
  id?: ComponentId;
129
134
  includeStories?: StoryDescriptor;
130
135
  excludeStories?: StoryDescriptor;
131
- component?: TFramework['component'];
136
+ component?: (TFramework & {
137
+ T: Args extends TArgs ? any : TArgs;
138
+ })['component'];
132
139
  subcomponents?: Record<string, TFramework['component']>;
133
- };
134
- export declare type StoryAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = BaseAnnotations<TFramework, TArgs> & {
140
+ }
141
+ export declare type StoryAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args, TRequiredArgs = Partial<TArgs>> = BaseAnnotations<TFramework, TArgs> & {
135
142
  name?: StoryName;
136
143
  storyName?: StoryName;
137
144
  play?: PlayFunction<TFramework, TArgs>;
138
145
  story?: Omit<StoryAnnotations<TFramework, TArgs>, 'story'>;
139
- };
146
+ } & ({} extends TRequiredArgs ? {
147
+ args?: TRequiredArgs;
148
+ } : {
149
+ args: TRequiredArgs;
150
+ });
140
151
  export declare type LegacyAnnotatedStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryFn<TFramework, TArgs> & StoryAnnotations<TFramework, TArgs>;
141
152
  export declare type LegacyStoryAnnotationsOrFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = LegacyAnnotatedStoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>;
142
153
  export declare type AnnotatedStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = ArgsStoryFn<TFramework, TArgs> & StoryAnnotations<TFramework, TArgs>;
@@ -6,11 +6,11 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
6
6
 
7
7
  // NOTE Example of internal type definition for @storybook/<X> (where X is a framework)
8
8
  // NOTE Examples of using types from @storybook/<X> in real project
9
- var Button = function Button() {
9
+ var Button = function Button(props) {
10
10
  return 'Button';
11
- };
11
+ }; // NOTE Various kind usages
12
+
12
13
 
13
- // NOTE Various kind usages
14
14
  var simple = {
15
15
  title: 'simple',
16
16
  component: Button,
@@ -30,10 +30,10 @@ var simple = {
30
30
  });
31
31
  }],
32
32
  args: {
33
- a: 1
33
+ x: '1'
34
34
  },
35
35
  argTypes: {
36
- a: {
36
+ x: {
37
37
  type: {
38
38
  name: 'string'
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/csf",
3
- "version": "0.0.2--canary.48.3bd2bd7.0",
3
+ "version": "0.0.2--canary.49.b089ae5.0",
4
4
  "description": "Component Story Format (CSF) utilities",
5
5
  "keywords": [
6
6
  "storybook",
@@ -61,7 +61,7 @@
61
61
  "common-tags": "^1.8.0",
62
62
  "eslint": "^6.7.1",
63
63
  "jest": "^24.9.0",
64
- "prettier": "^1.19.1",
64
+ "prettier": "^2.7.1",
65
65
  "typescript": "^3.7.2"
66
66
  },
67
67
  "auto": {