@storybook/angular 8.0.0-alpha.7 → 8.0.0-alpha.8
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnnotatedStoryFn, Args, ComponentAnnotations, DecoratorFunction, LoaderFunction, StoryAnnotations, StoryContext as GenericStoryContext, StrictArgs, ProjectAnnotations } from '@storybook/types';
|
|
2
|
+
import { EventEmitter } from '@angular/core';
|
|
2
3
|
import { AngularRenderer } from './types';
|
|
3
4
|
export type { Args, ArgTypes, Parameters, StrictArgs } from '@storybook/types';
|
|
4
5
|
export type { Parameters as AngularParameters } from './types';
|
|
@@ -8,19 +9,19 @@ export type { AngularRenderer };
|
|
|
8
9
|
*
|
|
9
10
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
10
11
|
*/
|
|
11
|
-
export type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TArgs
|
|
12
|
+
export type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TransformEventType<TArgs>>;
|
|
12
13
|
/**
|
|
13
14
|
* Story function that represents a CSFv2 component example.
|
|
14
15
|
*
|
|
15
16
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
16
17
|
*/
|
|
17
|
-
export type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TArgs
|
|
18
|
+
export type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TransformEventType<TArgs>>;
|
|
18
19
|
/**
|
|
19
20
|
* Story function that represents a CSFv3 component example.
|
|
20
21
|
*
|
|
21
22
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
22
23
|
*/
|
|
23
|
-
export type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TArgs
|
|
24
|
+
export type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TransformEventType<TArgs>>;
|
|
24
25
|
/**
|
|
25
26
|
* @deprecated Use `StoryFn` instead.
|
|
26
27
|
* Use `StoryObj` if you want to migrate to CSF3, which uses objects instead of functions to represent stories.
|
|
@@ -35,3 +36,6 @@ export type Decorator<TArgs = StrictArgs> = DecoratorFunction<AngularRenderer, T
|
|
|
35
36
|
export type Loader<TArgs = StrictArgs> = LoaderFunction<AngularRenderer, TArgs>;
|
|
36
37
|
export type StoryContext<TArgs = StrictArgs> = GenericStoryContext<AngularRenderer, TArgs>;
|
|
37
38
|
export type Preview = ProjectAnnotations<AngularRenderer>;
|
|
39
|
+
type TransformEventType<T> = {
|
|
40
|
+
[K in keyof T]: T[K] extends EventEmitter<infer E> ? (e: E) => void : T[K];
|
|
41
|
+
};
|
package/dist/client/types.d.ts
CHANGED
|
@@ -30,10 +30,6 @@ export interface StoryFnAngularReturnType {
|
|
|
30
30
|
styles?: string[];
|
|
31
31
|
userDefinedTemplate?: boolean;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use `AngularRenderer` instead.
|
|
35
|
-
*/
|
|
36
|
-
export type AngularFramework = AngularRenderer;
|
|
37
33
|
export interface AngularRenderer extends WebRenderer {
|
|
38
34
|
component: any;
|
|
39
35
|
storyResult: StoryFnAngularReturnType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.8",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@storybook/builder-webpack5": "8.0.0-alpha.
|
|
41
|
-
"@storybook/cli": "8.0.0-alpha.
|
|
42
|
-
"@storybook/client-logger": "8.0.0-alpha.
|
|
43
|
-
"@storybook/core-common": "8.0.0-alpha.
|
|
44
|
-
"@storybook/core-events": "8.0.0-alpha.
|
|
45
|
-
"@storybook/core-server": "8.0.0-alpha.
|
|
46
|
-
"@storybook/core-webpack": "8.0.0-alpha.
|
|
47
|
-
"@storybook/docs-tools": "8.0.0-alpha.
|
|
40
|
+
"@storybook/builder-webpack5": "8.0.0-alpha.8",
|
|
41
|
+
"@storybook/cli": "8.0.0-alpha.8",
|
|
42
|
+
"@storybook/client-logger": "8.0.0-alpha.8",
|
|
43
|
+
"@storybook/core-common": "8.0.0-alpha.8",
|
|
44
|
+
"@storybook/core-events": "8.0.0-alpha.8",
|
|
45
|
+
"@storybook/core-server": "8.0.0-alpha.8",
|
|
46
|
+
"@storybook/core-webpack": "8.0.0-alpha.8",
|
|
47
|
+
"@storybook/docs-tools": "8.0.0-alpha.8",
|
|
48
48
|
"@storybook/global": "^5.0.0",
|
|
49
|
-
"@storybook/node-logger": "8.0.0-alpha.
|
|
50
|
-
"@storybook/preview-api": "8.0.0-alpha.
|
|
51
|
-
"@storybook/telemetry": "8.0.0-alpha.
|
|
52
|
-
"@storybook/types": "8.0.0-alpha.
|
|
49
|
+
"@storybook/node-logger": "8.0.0-alpha.8",
|
|
50
|
+
"@storybook/preview-api": "8.0.0-alpha.8",
|
|
51
|
+
"@storybook/telemetry": "8.0.0-alpha.8",
|
|
52
|
+
"@storybook/types": "8.0.0-alpha.8",
|
|
53
53
|
"@types/node": "^18.0.0",
|
|
54
54
|
"@types/react": "^18.0.37",
|
|
55
55
|
"@types/react-dom": "^18.0.11",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
3
|
import { ButtonComponent } from './button.component';
|
|
4
4
|
|
|
5
5
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
@@ -7,17 +7,13 @@ const meta: Meta<ButtonComponent> = {
|
|
|
7
7
|
title: 'Example/Button',
|
|
8
8
|
component: ButtonComponent,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
-
render: (args: ButtonComponent) => ({
|
|
11
|
-
props: {
|
|
12
|
-
backgroundColor: null,
|
|
13
|
-
...args,
|
|
14
|
-
},
|
|
15
|
-
}),
|
|
16
10
|
argTypes: {
|
|
17
11
|
backgroundColor: {
|
|
18
12
|
control: 'color',
|
|
19
13
|
},
|
|
20
14
|
},
|
|
15
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
16
|
+
args: { onClick: fn() },
|
|
21
17
|
};
|
|
22
18
|
|
|
23
19
|
export default meta;
|