@storybook/vue3 8.3.0-alpha.6 → 8.3.0-alpha.7
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/index.d.ts +29 -22
- package/package.json +6 -6
- package/template/stories/preview.js +0 -1
package/dist/index.d.ts
CHANGED
@@ -15,33 +15,37 @@ type JSXAble<TElement> = TElement & {
|
|
15
15
|
type MapToJSXAble<T> = {
|
16
16
|
[K in keyof T]: JSXAble<T[K]>;
|
17
17
|
};
|
18
|
-
/**
|
18
|
+
/**
|
19
|
+
* Function that sets the globalConfig of your Storybook. The global config is the preview module of
|
20
|
+
* your .storybook folder.
|
19
21
|
*
|
20
|
-
* It should be run a single time, so that your global config (e.g. decorators) is applied to your
|
22
|
+
* It should be run a single time, so that your global config (e.g. decorators) is applied to your
|
23
|
+
* stories when using `composeStories` or `composeStory`.
|
21
24
|
*
|
22
25
|
* Example:
|
23
|
-
|
26
|
+
*
|
27
|
+
* ```jsx
|
24
28
|
* // setup.js (for jest)
|
25
29
|
* import { setProjectAnnotations } from '@storybook/vue3';
|
26
30
|
* import projectAnnotations from './.storybook/preview';
|
27
31
|
*
|
28
32
|
* setProjectAnnotations(projectAnnotations);
|
29
|
-
|
33
|
+
* ```
|
30
34
|
*
|
31
|
-
* @param projectAnnotations -
|
35
|
+
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
|
32
36
|
*/
|
33
37
|
declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<VueRenderer>;
|
34
38
|
declare const vueProjectAnnotations: ProjectAnnotations<VueRenderer>;
|
35
39
|
/**
|
36
40
|
* Function that will receive a story along with meta (e.g. a default export from a .stories file)
|
37
|
-
* and optionally projectAnnotations e.g. (import * from '../.storybook/preview)
|
38
|
-
*
|
39
|
-
*
|
41
|
+
* and optionally projectAnnotations e.g. (import * from '../.storybook/preview) and will return a
|
42
|
+
* composed component that has all args/parameters/decorators/etc combined and applied to it.
|
40
43
|
*
|
41
44
|
* It's very useful for reusing a story in scenarios outside of Storybook like unit testing.
|
42
45
|
*
|
43
46
|
* Example:
|
44
|
-
|
47
|
+
*
|
48
|
+
* ```jsx
|
45
49
|
* import { render } from '@testing-library/vue';
|
46
50
|
* import { composeStory } from '@storybook/vue3';
|
47
51
|
* import Meta, { Primary as PrimaryStory } from './Button.stories';
|
@@ -49,27 +53,29 @@ declare const vueProjectAnnotations: ProjectAnnotations<VueRenderer>;
|
|
49
53
|
* const Primary = composeStory(PrimaryStory, Meta);
|
50
54
|
*
|
51
55
|
* test('renders primary button with Hello World', () => {
|
52
|
-
* const { getByText } = render(Primary, { props: { label:
|
56
|
+
* const { getByText } = render(Primary, { props: { label: 'Hello world' } });
|
53
57
|
* expect(getByText(/Hello world/i)).not.toBeNull();
|
54
58
|
* });
|
55
|
-
|
59
|
+
* ```
|
56
60
|
*
|
57
61
|
* @param story
|
58
|
-
* @param componentAnnotations -
|
59
|
-
* @param [projectAnnotations] -
|
60
|
-
*
|
62
|
+
* @param componentAnnotations - E.g. (import Meta from './Button.stories')
|
63
|
+
* @param [projectAnnotations] - E.g. (import * as projectAnnotations from '../.storybook/preview')
|
64
|
+
* this can be applied automatically if you use `setProjectAnnotations` in your setup files.
|
65
|
+
* @param [exportsName] - In case your story does not contain a name and you want it to have a name.
|
61
66
|
*/
|
62
67
|
declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotationsOrFn<VueRenderer, TArgs>, componentAnnotations: Meta<TArgs | any>, projectAnnotations?: ProjectAnnotations<VueRenderer>, exportsName?: string): JSXAble<ComposedStoryFn<VueRenderer, Partial<TArgs>>>;
|
63
68
|
/**
|
64
69
|
* Function that will receive a stories import (e.g. `import * as stories from './Button.stories'`)
|
65
|
-
* and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`)
|
66
|
-
*
|
67
|
-
*
|
70
|
+
* and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`) and will return
|
71
|
+
* an object containing all the stories passed, but now as a composed component that has all
|
72
|
+
* args/parameters/decorators/etc combined and applied to it.
|
68
73
|
*
|
69
74
|
* It's very useful for reusing stories in scenarios outside of Storybook like unit testing.
|
70
75
|
*
|
71
76
|
* Example:
|
72
|
-
|
77
|
+
*
|
78
|
+
* ```jsx
|
73
79
|
* import { render } from '@testing-library/vue';
|
74
80
|
* import { composeStories } from '@storybook/vue3';
|
75
81
|
* import * as stories from './Button.stories';
|
@@ -77,13 +83,14 @@ declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotations
|
|
77
83
|
* const { Primary, Secondary } = composeStories(stories);
|
78
84
|
*
|
79
85
|
* test('renders primary button with Hello World', () => {
|
80
|
-
* const { getByText } = render(Primary, { props: { label:
|
86
|
+
* const { getByText } = render(Primary, { props: { label: 'Hello world' } });
|
81
87
|
* expect(getByText(/Hello world/i)).not.toBeNull();
|
82
88
|
* });
|
83
|
-
|
89
|
+
* ```
|
84
90
|
*
|
85
|
-
* @param csfExports -
|
86
|
-
* @param [projectAnnotations] -
|
91
|
+
* @param csfExports - E.g. (import * as stories from './Button.stories')
|
92
|
+
* @param [projectAnnotations] - E.g. (import * as projectAnnotations from '../.storybook/preview')
|
93
|
+
* this can be applied automatically if you use `setProjectAnnotations` in your setup files.
|
87
94
|
*/
|
88
95
|
declare function composeStories<TModule extends Store_CSFExports<VueRenderer, any>>(csfExports: TModule, projectAnnotations?: ProjectAnnotations<VueRenderer>): MapToJSXAble<Omit<StoriesWithPartialProps<VueRenderer, TModule>, keyof Store_CSFExports>>;
|
89
96
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/vue3",
|
3
|
-
"version": "8.3.0-alpha.
|
3
|
+
"version": "8.3.0-alpha.7",
|
4
4
|
"description": "Storybook Vue 3 renderer",
|
5
5
|
"keywords": [
|
6
6
|
"storybook"
|
@@ -63,11 +63,11 @@
|
|
63
63
|
"prep": "jiti ../../../scripts/prepare/bundle.ts"
|
64
64
|
},
|
65
65
|
"dependencies": {
|
66
|
-
"@storybook/components": "^8.3.0-alpha.
|
66
|
+
"@storybook/components": "^8.3.0-alpha.7",
|
67
67
|
"@storybook/global": "^5.0.0",
|
68
|
-
"@storybook/manager-api": "^8.3.0-alpha.
|
69
|
-
"@storybook/preview-api": "^8.3.0-alpha.
|
70
|
-
"@storybook/theming": "^8.3.0-alpha.
|
68
|
+
"@storybook/manager-api": "^8.3.0-alpha.7",
|
69
|
+
"@storybook/preview-api": "^8.3.0-alpha.7",
|
70
|
+
"@storybook/theming": "^8.3.0-alpha.7",
|
71
71
|
"@vue/compiler-core": "^3.0.0",
|
72
72
|
"ts-dedent": "^2.0.0",
|
73
73
|
"type-fest": "~2.19",
|
@@ -84,7 +84,7 @@
|
|
84
84
|
"vue-tsc": "latest"
|
85
85
|
},
|
86
86
|
"peerDependencies": {
|
87
|
-
"storybook": "^8.3.0-alpha.
|
87
|
+
"storybook": "^8.3.0-alpha.7",
|
88
88
|
"vue": "^3.0.0"
|
89
89
|
},
|
90
90
|
"engines": {
|