@storybook/csf 0.0.2--canary.49.b089ae5.0 → 0.0.2--canary.51.768ca23.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  import { Args, Globals, InputType, Conditional } from './story';
2
- export declare const testValue: (cond: Pick<Conditional, never>, value: any) => boolean;
2
+ export declare const testValue: (cond: Omit<Conditional, 'arg' | 'global'>, value: any) => boolean;
3
3
  export declare const includeConditionalArg: (argType: InputType, args: Args, globals: Globals) => boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const sanitize: (string: string) => string;
2
- export declare const toId: (kind: string, name?: string | undefined) => string;
2
+ export declare const toId: (kind: string, name?: string) => string;
3
3
  export declare const storyNameFromExport: (key: string) => string;
4
4
  declare type StoryDescriptor = string[] | RegExp;
5
5
  export interface IncludeExcludeOptions {
package/dist/story.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Simplify, UnionToIntersection } from 'type-fest';
1
2
  import { SBType, SBScalarType } from './SBType';
2
3
  export * from './SBType';
3
4
  export declare type StoryId = string;
@@ -70,9 +71,9 @@ export declare type StoryContextForEnhancers<TFramework extends AnyFramework = A
70
71
  component?: (TFramework & {
71
72
  T: any;
72
73
  })['component'];
73
- subcomponents?: (TFramework & {
74
+ subcomponents?: Record<string, (TFramework & {
74
75
  T: any;
75
- })['component'];
76
+ })['component']>;
76
77
  parameters: Parameters;
77
78
  initialArgs: TArgs;
78
79
  argTypes: StrictArgTypes<TArgs>;
@@ -106,7 +107,9 @@ export declare type PlayFunctionContext<TFramework extends AnyFramework = AnyFra
106
107
  export declare type PlayFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: PlayFunctionContext<TFramework, TArgs>) => Promise<void> | void;
107
108
  export declare type PartialStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TFramework['storyResult'];
108
109
  export declare type LegacyStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
109
- export declare type ArgsStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (args: TArgs, context: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
110
+ export declare type ArgsStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (args: TArgs, context: StoryContext<TFramework, TArgs>) => (TFramework & {
111
+ T: TArgs;
112
+ })['storyResult'];
110
113
  export declare type StoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = LegacyStoryFn<TFramework, TArgs> | ArgsStoryFn<TFramework, TArgs>;
111
114
  export declare type DecoratorFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (fn: PartialStoryFn<TFramework, TArgs>, c: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
112
115
  export declare type DecoratorApplicator<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (storyFn: LegacyStoryFn<TFramework, TArgs>, decorators: DecoratorFunction<TFramework, TArgs>[]) => LegacyStoryFn<TFramework, TArgs>;
@@ -152,3 +155,10 @@ export declare type LegacyAnnotatedStoryFn<TFramework extends AnyFramework = Any
152
155
  export declare type LegacyStoryAnnotationsOrFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = LegacyAnnotatedStoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>;
153
156
  export declare type AnnotatedStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = ArgsStoryFn<TFramework, TArgs> & StoryAnnotations<TFramework, TArgs>;
154
157
  export declare type StoryAnnotationsOrFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = AnnotatedStoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>;
158
+ export declare type ArgsFromMeta<TFramework extends AnyFramework, Meta> = Meta extends {
159
+ render?: ArgsStoryFn<TFramework, infer RArgs>;
160
+ loaders?: (infer Loaders)[];
161
+ decorators?: (infer Decorators)[];
162
+ } ? Simplify<RArgs & DecoratorsArgs<TFramework, Decorators> & LoaderArgs<TFramework, Loaders>> : unknown;
163
+ declare type DecoratorsArgs<TFramework extends AnyFramework, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TFramework, infer Args> ? Args : unknown>;
164
+ declare type LoaderArgs<TFramework extends AnyFramework, Loaders> = UnionToIntersection<Loaders extends LoaderFunction<TFramework, infer Args> ? Args : unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/csf",
3
- "version": "0.0.2--canary.49.b089ae5.0",
3
+ "version": "0.0.2--canary.51.768ca23.0",
4
4
  "description": "Component Story Format (CSF) utilities",
5
5
  "keywords": [
6
6
  "storybook",
@@ -44,7 +44,8 @@
44
44
  ]
45
45
  },
46
46
  "dependencies": {
47
- "lodash": "^4.17.15"
47
+ "lodash": "^4.17.15",
48
+ "type-fest": "^2.19.0"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@auto-it/released": "^10.37.1",
@@ -62,7 +63,7 @@
62
63
  "eslint": "^6.7.1",
63
64
  "jest": "^24.9.0",
64
65
  "prettier": "^2.7.1",
65
- "typescript": "^3.7.2"
66
+ "typescript": "^4.8.4"
66
67
  },
67
68
  "auto": {
68
69
  "plugins": [