@repobuddy/storybook 0.1.0 → 0.2.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/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/manager/brand_title.d.ts +35 -0
- package/esm/manager/brand_title.js +28 -0
- package/esm/manager/tag_badges.js +1 -1
- package/esm/manager.d.ts +1 -0
- package/esm/manager.js +1 -0
- package/esm/parameters/define_docs_param.d.ts +181 -0
- package/esm/parameters/define_docs_param.js +3 -0
- package/esm/parameters/define_layout_param.d.ts +1 -1
- package/esm/parameters/define_viewport_param.d.ts +50 -0
- package/esm/parameters/define_viewport_param.js +3 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/src/index.ts +2 -0
- package/src/manager/brand_title.ts +41 -0
- package/src/manager/tag_badges.ts +1 -1
- package/src/manager.ts +1 -0
- package/src/parameters/define_docs_param.ts +206 -0
- package/src/parameters/define_viewport_param.ts +55 -0
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './parameters/define_actions_param.ts';
|
|
2
|
+
export * from './parameters/define_docs_param.ts';
|
|
2
3
|
export * from './parameters/define_layout_param.ts';
|
|
3
4
|
export * from './parameters/define_parameters.ts';
|
|
4
5
|
export * from './parameters/define_story_sort.ts';
|
|
5
6
|
export * from './parameters/define_test_param.ts';
|
|
7
|
+
export * from './parameters/define_viewport_param.ts';
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./parameters/define_actions_param.js";
|
|
2
|
+
export * from "./parameters/define_docs_param.js";
|
|
2
3
|
export * from "./parameters/define_layout_param.js";
|
|
3
4
|
export * from "./parameters/define_parameters.js";
|
|
4
5
|
export * from "./parameters/define_story_sort.js";
|
|
5
6
|
export * from "./parameters/define_test_param.js";
|
|
7
|
+
export * from "./parameters/define_viewport_param.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface BrandTitleOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The title to display in the brand title.
|
|
4
|
+
* It can be a simple string or raw HTML.
|
|
5
|
+
*/
|
|
6
|
+
title: string;
|
|
7
|
+
/**
|
|
8
|
+
* The icon to display in the brand title.
|
|
9
|
+
* It can be a simple string or raw HTML (e.g. `<svg>`).
|
|
10
|
+
*/
|
|
11
|
+
icon?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a brand title element for the Storybook manager UI.
|
|
15
|
+
*
|
|
16
|
+
* @param options - The options for customizing the brand title
|
|
17
|
+
* @param options.title - The title text or HTML to display
|
|
18
|
+
* @param options.icon - Optional icon HTML to display before the title
|
|
19
|
+
* @returns An HTML string containing the brand title element
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { brandTitle } from '@repobuddy/storybook'
|
|
25
|
+
* import { addons } from '@storybook/manager-api'
|
|
26
|
+
*
|
|
27
|
+
* addons.setConfig({
|
|
28
|
+
* brandTitle: brandTitle({
|
|
29
|
+
* title: 'My Storybook',
|
|
30
|
+
* icon: '<img src="logo.png" alt="Logo" width="24" height="24">'
|
|
31
|
+
* })
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function brandTitle(options: BrandTitleOptions): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a brand title element for the Storybook manager UI.
|
|
3
|
+
*
|
|
4
|
+
* @param options - The options for customizing the brand title
|
|
5
|
+
* @param options.title - The title text or HTML to display
|
|
6
|
+
* @param options.icon - Optional icon HTML to display before the title
|
|
7
|
+
* @returns An HTML string containing the brand title element
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { brandTitle } from '@repobuddy/storybook'
|
|
13
|
+
* import { addons } from '@storybook/manager-api'
|
|
14
|
+
*
|
|
15
|
+
* addons.setConfig({
|
|
16
|
+
* brandTitle: brandTitle({
|
|
17
|
+
* title: 'My Storybook',
|
|
18
|
+
* icon: '<img src="logo.png" alt="Logo" width="24" height="24">'
|
|
19
|
+
* })
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function brandTitle(options) {
|
|
24
|
+
return `<span style="display: flex; align-items: center; gap: 2px;">
|
|
25
|
+
${options.icon ?? ''}
|
|
26
|
+
${options.title}
|
|
27
|
+
</span>`;
|
|
28
|
+
}
|
package/esm/manager.d.ts
CHANGED
package/esm/manager.js
CHANGED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { StoryContext } from '@storybook/react';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace JSX {
|
|
4
|
+
interface Element {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export interface SourceProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provides the source code to be rendered.
|
|
11
|
+
*
|
|
12
|
+
* This is useful when the story contains extra code that would be confusing in the docs.
|
|
13
|
+
*
|
|
14
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#code
|
|
15
|
+
*/
|
|
16
|
+
code?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Specifies whether the source code should be rendered in dark mode.
|
|
19
|
+
*
|
|
20
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#dark
|
|
21
|
+
*/
|
|
22
|
+
dark?: boolean | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Specifies whether decorators should be excluded from the source code.
|
|
25
|
+
*
|
|
26
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#excludedecorators
|
|
27
|
+
*/
|
|
28
|
+
excludeDecorators?: boolean | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Specifies the language of the source code.
|
|
31
|
+
*
|
|
32
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#language
|
|
33
|
+
*/
|
|
34
|
+
language?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* A function to dynamically transform the source before being rendered,
|
|
37
|
+
* based on the original source and any story context necessary.
|
|
38
|
+
* The returned string is displayed as-is.
|
|
39
|
+
*
|
|
40
|
+
* If both code and transform are specified, transform will be ignored.
|
|
41
|
+
*
|
|
42
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#transform
|
|
43
|
+
*/
|
|
44
|
+
transform?: ((code: string, storyContext: StoryContext) => string) | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Specifies how the source code is rendered.
|
|
47
|
+
*
|
|
48
|
+
* - auto: Same as dynamic, if the story's render function accepts args inputs and dynamic is supported by the framework in use; otherwise same as code
|
|
49
|
+
* - code: Renders the value of code prop, otherwise renders static story source
|
|
50
|
+
* - dynamic: Renders the story source with dynamically updated arg values
|
|
51
|
+
*
|
|
52
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#type
|
|
53
|
+
*/
|
|
54
|
+
type?: 'auto' | 'code' | 'dynamic' | undefined;
|
|
55
|
+
}
|
|
56
|
+
export interface DocsParam {
|
|
57
|
+
docs: {
|
|
58
|
+
argTypes?: {
|
|
59
|
+
/**
|
|
60
|
+
* Specifies which controls to exclude from the args table.
|
|
61
|
+
* Any controls whose names match the regex or are part of the array will be left out.
|
|
62
|
+
*
|
|
63
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#exclude
|
|
64
|
+
*/
|
|
65
|
+
exclude?: string[] | RegExp | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Specifies which controls to include in the args table.
|
|
68
|
+
* Any controls whose names don't match the regex or are not part of the array will be left out.
|
|
69
|
+
*
|
|
70
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#include
|
|
71
|
+
*/
|
|
72
|
+
include?: string[] | RegExp | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies how the arg types are sorted.
|
|
75
|
+
*
|
|
76
|
+
* - none: Unsorted, displayed in the same order the arg types are processed in
|
|
77
|
+
* - alpha: Sorted alphabetically, by the arg type's name
|
|
78
|
+
* - requiredFirst: Same as alpha, with any required arg types displayed first
|
|
79
|
+
*
|
|
80
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#sort
|
|
81
|
+
*/
|
|
82
|
+
sort?: 'alpha' | 'requiredFirst' | 'none' | undefined;
|
|
83
|
+
} | undefined;
|
|
84
|
+
description?: {
|
|
85
|
+
/**
|
|
86
|
+
* `docs.description.story` can be used to describe the story in doc.
|
|
87
|
+
*/
|
|
88
|
+
story?: string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* `docs.description.component` can be used to describe the component in meta.
|
|
91
|
+
* It has no effect on the stories.
|
|
92
|
+
*/
|
|
93
|
+
component?: string | undefined;
|
|
94
|
+
} | undefined;
|
|
95
|
+
source?: SourceProps | undefined;
|
|
96
|
+
canvas?: {
|
|
97
|
+
/**
|
|
98
|
+
* Provides any additional custom actions to show in the bottom right corner.
|
|
99
|
+
* These are simple buttons that do anything you specify in the onClick function.
|
|
100
|
+
*
|
|
101
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#additionalactions
|
|
102
|
+
*/
|
|
103
|
+
additionalActions?: Array<{
|
|
104
|
+
title: string | JSX.Element;
|
|
105
|
+
className?: string;
|
|
106
|
+
onClick: () => void;
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
}> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Provides HTML class(es) to the preview element, for custom styling.
|
|
111
|
+
*
|
|
112
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#classname
|
|
113
|
+
*/
|
|
114
|
+
className?: string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Specifies how the canvas should layout the story.
|
|
117
|
+
*
|
|
118
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#layout
|
|
119
|
+
*/
|
|
120
|
+
layout?: 'centered' | 'padded' | 'fullscreen' | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Specifies the initial state of the source panel.
|
|
123
|
+
*
|
|
124
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#sourcestate
|
|
125
|
+
*/
|
|
126
|
+
sourceState?: 'hidden' | 'shown' | 'none' | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Determines whether to render a toolbar containing tools to interact with the story.
|
|
129
|
+
*
|
|
130
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#withtoolbar
|
|
131
|
+
*/
|
|
132
|
+
withToolbar?: boolean | undefined;
|
|
133
|
+
} | undefined;
|
|
134
|
+
controls?: {
|
|
135
|
+
/**
|
|
136
|
+
* Specifies which controls to exclude from the args table.
|
|
137
|
+
* Any controls whose names match the regex or are part of the array will be left out.
|
|
138
|
+
*
|
|
139
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#exclude
|
|
140
|
+
*/
|
|
141
|
+
exclude?: string[] | RegExp | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Specifies which controls to include in the args table.
|
|
144
|
+
* Any controls whose names don't match the regex or are not part of the array will be left out.
|
|
145
|
+
*
|
|
146
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#include
|
|
147
|
+
*/
|
|
148
|
+
include?: string[] | RegExp | undefined;
|
|
149
|
+
/**
|
|
150
|
+
*
|
|
151
|
+
* Specifies how the controls are sorted.
|
|
152
|
+
*
|
|
153
|
+
* - none: Unsorted, displayed in the same order the controls are processed in
|
|
154
|
+
* - alpha: Sorted alphabetically, by the arg type's name
|
|
155
|
+
* - requiredFirst: Same as alpha, with any required controls displayed first
|
|
156
|
+
*
|
|
157
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#sort
|
|
158
|
+
*/
|
|
159
|
+
sort?: 'alpha' | 'requiredFirst' | 'none' | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
story?: {
|
|
162
|
+
/**
|
|
163
|
+
* Specifies whether the story should be autoplayed.
|
|
164
|
+
*
|
|
165
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-story#autoplay
|
|
166
|
+
*/
|
|
167
|
+
autoplay?: boolean | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Set a minimum height (note for an iframe this is the actual height) when rendering a story in an iframe or inline.
|
|
170
|
+
* This overrides parameters.docs.story.iframeHeight for iframes.
|
|
171
|
+
*/
|
|
172
|
+
height?: string | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Determines whether the story is rendered inline (in the same browser frame as the other docs content) or in an iframe.
|
|
175
|
+
*/
|
|
176
|
+
inline?: boolean | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
[k: string]: unknown;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export declare function defineDocsParam(docs: DocsParam['docs']): DocsParam['docs'];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface ViewportParam {
|
|
2
|
+
viewport: {
|
|
3
|
+
/**
|
|
4
|
+
* @see https://storybook.js.org/docs/essentials/viewport#viewports
|
|
5
|
+
*/
|
|
6
|
+
viewports?: Record<string, Viewport> | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultorientation
|
|
9
|
+
*/
|
|
10
|
+
defaultOrientation?: 'landscape' | 'portrait' | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultviewport
|
|
13
|
+
*/
|
|
14
|
+
defaultViewport?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Disables the viewport parameter.
|
|
17
|
+
* @deprecated Use `disabled` instead.
|
|
18
|
+
*/
|
|
19
|
+
disable?: boolean | undefined;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface Viewport {
|
|
23
|
+
name: string;
|
|
24
|
+
styles: {
|
|
25
|
+
width: string;
|
|
26
|
+
height: string;
|
|
27
|
+
};
|
|
28
|
+
type: 'mobile' | 'tablet' | 'desktop';
|
|
29
|
+
}
|
|
30
|
+
export interface ViewportParamV9 {
|
|
31
|
+
viewport: {
|
|
32
|
+
/**
|
|
33
|
+
* @see https://storybook.js.org/docs/essentials/viewport#viewports
|
|
34
|
+
*/
|
|
35
|
+
options?: Record<string, Viewport> | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultviewport
|
|
38
|
+
*/
|
|
39
|
+
defaultViewport?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultorientation
|
|
42
|
+
*/
|
|
43
|
+
defaultOrientation?: 'landscape' | 'portrait' | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* @see https://storybook.js.org/docs/essentials/viewport#disable
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean | undefined;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export declare function defineViewportParam(viewport: ViewportParam['viewport'] | ViewportParamV9['viewport']): ViewportParam;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -58,7 +58,7 @@ we provide a different set of badges that uses icons:
|
|
|
58
58
|
- 📋 To-do items
|
|
59
59
|
- 📝 Code-only stories
|
|
60
60
|
- 🧪 Unit tests
|
|
61
|
-
-
|
|
61
|
+
- 🔄 Integration tests
|
|
62
62
|
- Version indicators (unchanged)
|
|
63
63
|
|
|
64
64
|
To use them, add them to your `.storybook/manager.ts`:
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './parameters/define_actions_param.ts'
|
|
2
|
+
export * from './parameters/define_docs_param.ts'
|
|
2
3
|
export * from './parameters/define_layout_param.ts'
|
|
3
4
|
export * from './parameters/define_parameters.ts'
|
|
4
5
|
export * from './parameters/define_story_sort.ts'
|
|
5
6
|
export * from './parameters/define_test_param.ts'
|
|
7
|
+
export * from './parameters/define_viewport_param.ts'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface BrandTitleOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The title to display in the brand title.
|
|
4
|
+
* It can be a simple string or raw HTML.
|
|
5
|
+
*/
|
|
6
|
+
title: string
|
|
7
|
+
/**
|
|
8
|
+
* The icon to display in the brand title.
|
|
9
|
+
* It can be a simple string or raw HTML (e.g. `<svg>`).
|
|
10
|
+
*/
|
|
11
|
+
icon?: string | undefined
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a brand title element for the Storybook manager UI.
|
|
16
|
+
*
|
|
17
|
+
* @param options - The options for customizing the brand title
|
|
18
|
+
* @param options.title - The title text or HTML to display
|
|
19
|
+
* @param options.icon - Optional icon HTML to display before the title
|
|
20
|
+
* @returns An HTML string containing the brand title element
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { brandTitle } from '@repobuddy/storybook'
|
|
26
|
+
* import { addons } from '@storybook/manager-api'
|
|
27
|
+
*
|
|
28
|
+
* addons.setConfig({
|
|
29
|
+
* brandTitle: brandTitle({
|
|
30
|
+
* title: 'My Storybook',
|
|
31
|
+
* icon: '<img src="logo.png" alt="Logo" width="24" height="24">'
|
|
32
|
+
* })
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function brandTitle(options: BrandTitleOptions) {
|
|
37
|
+
return `<span style="display: flex; align-items: center; gap: 2px;">
|
|
38
|
+
${options.icon ?? ''}
|
|
39
|
+
${options.title}
|
|
40
|
+
</span>`
|
|
41
|
+
}
|
package/src/manager.ts
CHANGED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { StoryContext } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
interface Element {}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SourceProps {
|
|
10
|
+
/**
|
|
11
|
+
* Provides the source code to be rendered.
|
|
12
|
+
*
|
|
13
|
+
* This is useful when the story contains extra code that would be confusing in the docs.
|
|
14
|
+
*
|
|
15
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#code
|
|
16
|
+
*/
|
|
17
|
+
code?: string | undefined
|
|
18
|
+
/**
|
|
19
|
+
* Specifies whether the source code should be rendered in dark mode.
|
|
20
|
+
*
|
|
21
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#dark
|
|
22
|
+
*/
|
|
23
|
+
dark?: boolean | undefined
|
|
24
|
+
/**
|
|
25
|
+
* Specifies whether decorators should be excluded from the source code.
|
|
26
|
+
*
|
|
27
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#excludedecorators
|
|
28
|
+
*/
|
|
29
|
+
excludeDecorators?: boolean | undefined
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the language of the source code.
|
|
32
|
+
*
|
|
33
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#language
|
|
34
|
+
*/
|
|
35
|
+
language?: string | undefined
|
|
36
|
+
/**
|
|
37
|
+
* A function to dynamically transform the source before being rendered,
|
|
38
|
+
* based on the original source and any story context necessary.
|
|
39
|
+
* The returned string is displayed as-is.
|
|
40
|
+
*
|
|
41
|
+
* If both code and transform are specified, transform will be ignored.
|
|
42
|
+
*
|
|
43
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#transform
|
|
44
|
+
*/
|
|
45
|
+
transform?: ((code: string, storyContext: StoryContext) => string) | undefined
|
|
46
|
+
/**
|
|
47
|
+
* Specifies how the source code is rendered.
|
|
48
|
+
*
|
|
49
|
+
* - auto: Same as dynamic, if the story's render function accepts args inputs and dynamic is supported by the framework in use; otherwise same as code
|
|
50
|
+
* - code: Renders the value of code prop, otherwise renders static story source
|
|
51
|
+
* - dynamic: Renders the story source with dynamically updated arg values
|
|
52
|
+
*
|
|
53
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-source#type
|
|
54
|
+
*/
|
|
55
|
+
type?: 'auto' | 'code' | 'dynamic' | undefined
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface DocsParam {
|
|
59
|
+
docs: {
|
|
60
|
+
argTypes?:
|
|
61
|
+
| {
|
|
62
|
+
/**
|
|
63
|
+
* Specifies which controls to exclude from the args table.
|
|
64
|
+
* Any controls whose names match the regex or are part of the array will be left out.
|
|
65
|
+
*
|
|
66
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#exclude
|
|
67
|
+
*/
|
|
68
|
+
exclude?: string[] | RegExp | undefined
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Specifies which controls to include in the args table.
|
|
72
|
+
* Any controls whose names don't match the regex or are not part of the array will be left out.
|
|
73
|
+
*
|
|
74
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#include
|
|
75
|
+
*/
|
|
76
|
+
include?: string[] | RegExp | undefined
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Specifies how the arg types are sorted.
|
|
80
|
+
*
|
|
81
|
+
* - none: Unsorted, displayed in the same order the arg types are processed in
|
|
82
|
+
* - alpha: Sorted alphabetically, by the arg type's name
|
|
83
|
+
* - requiredFirst: Same as alpha, with any required arg types displayed first
|
|
84
|
+
*
|
|
85
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-argtypes#sort
|
|
86
|
+
*/
|
|
87
|
+
sort?: 'alpha' | 'requiredFirst' | 'none' | undefined
|
|
88
|
+
}
|
|
89
|
+
| undefined
|
|
90
|
+
description?:
|
|
91
|
+
| {
|
|
92
|
+
/**
|
|
93
|
+
* `docs.description.story` can be used to describe the story in doc.
|
|
94
|
+
*/
|
|
95
|
+
story?: string | undefined
|
|
96
|
+
/**
|
|
97
|
+
* `docs.description.component` can be used to describe the component in meta.
|
|
98
|
+
* It has no effect on the stories.
|
|
99
|
+
*/
|
|
100
|
+
component?: string | undefined
|
|
101
|
+
}
|
|
102
|
+
| undefined
|
|
103
|
+
source?: SourceProps | undefined
|
|
104
|
+
canvas?:
|
|
105
|
+
| {
|
|
106
|
+
/**
|
|
107
|
+
* Provides any additional custom actions to show in the bottom right corner.
|
|
108
|
+
* These are simple buttons that do anything you specify in the onClick function.
|
|
109
|
+
*
|
|
110
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#additionalactions
|
|
111
|
+
*/
|
|
112
|
+
additionalActions?:
|
|
113
|
+
| Array<{
|
|
114
|
+
title: string | JSX.Element
|
|
115
|
+
className?: string
|
|
116
|
+
onClick: () => void
|
|
117
|
+
disabled?: boolean
|
|
118
|
+
}>
|
|
119
|
+
| undefined
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Provides HTML class(es) to the preview element, for custom styling.
|
|
123
|
+
*
|
|
124
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#classname
|
|
125
|
+
*/
|
|
126
|
+
className?: string | undefined
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Specifies how the canvas should layout the story.
|
|
130
|
+
*
|
|
131
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#layout
|
|
132
|
+
*/
|
|
133
|
+
layout?: 'centered' | 'padded' | 'fullscreen' | undefined
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Specifies the initial state of the source panel.
|
|
137
|
+
*
|
|
138
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#sourcestate
|
|
139
|
+
*/
|
|
140
|
+
sourceState?: 'hidden' | 'shown' | 'none' | undefined
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Determines whether to render a toolbar containing tools to interact with the story.
|
|
144
|
+
*
|
|
145
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas#withtoolbar
|
|
146
|
+
*/
|
|
147
|
+
withToolbar?: boolean | undefined
|
|
148
|
+
}
|
|
149
|
+
| undefined
|
|
150
|
+
controls?:
|
|
151
|
+
| {
|
|
152
|
+
/**
|
|
153
|
+
* Specifies which controls to exclude from the args table.
|
|
154
|
+
* Any controls whose names match the regex or are part of the array will be left out.
|
|
155
|
+
*
|
|
156
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#exclude
|
|
157
|
+
*/
|
|
158
|
+
exclude?: string[] | RegExp | undefined
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Specifies which controls to include in the args table.
|
|
162
|
+
* Any controls whose names don't match the regex or are not part of the array will be left out.
|
|
163
|
+
*
|
|
164
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#include
|
|
165
|
+
*/
|
|
166
|
+
include?: string[] | RegExp | undefined
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
*
|
|
170
|
+
* Specifies how the controls are sorted.
|
|
171
|
+
*
|
|
172
|
+
* - none: Unsorted, displayed in the same order the controls are processed in
|
|
173
|
+
* - alpha: Sorted alphabetically, by the arg type's name
|
|
174
|
+
* - requiredFirst: Same as alpha, with any required controls displayed first
|
|
175
|
+
*
|
|
176
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls#sort
|
|
177
|
+
*/
|
|
178
|
+
sort?: 'alpha' | 'requiredFirst' | 'none' | undefined
|
|
179
|
+
}
|
|
180
|
+
| undefined
|
|
181
|
+
story?:
|
|
182
|
+
| {
|
|
183
|
+
/**
|
|
184
|
+
* Specifies whether the story should be autoplayed.
|
|
185
|
+
*
|
|
186
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-story#autoplay
|
|
187
|
+
*/
|
|
188
|
+
autoplay?: boolean | undefined
|
|
189
|
+
/**
|
|
190
|
+
* Set a minimum height (note for an iframe this is the actual height) when rendering a story in an iframe or inline.
|
|
191
|
+
* This overrides parameters.docs.story.iframeHeight for iframes.
|
|
192
|
+
*/
|
|
193
|
+
height?: string | undefined
|
|
194
|
+
/**
|
|
195
|
+
* Determines whether the story is rendered inline (in the same browser frame as the other docs content) or in an iframe.
|
|
196
|
+
*/
|
|
197
|
+
inline?: boolean | undefined
|
|
198
|
+
}
|
|
199
|
+
| undefined
|
|
200
|
+
[k: string]: unknown
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function defineDocsParam(docs: DocsParam['docs']): DocsParam['docs'] {
|
|
205
|
+
return { docs }
|
|
206
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface ViewportParam {
|
|
2
|
+
viewport: {
|
|
3
|
+
/**
|
|
4
|
+
* @see https://storybook.js.org/docs/essentials/viewport#viewports
|
|
5
|
+
*/
|
|
6
|
+
viewports?: Record<string, Viewport> | undefined
|
|
7
|
+
/**
|
|
8
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultorientation
|
|
9
|
+
*/
|
|
10
|
+
defaultOrientation?: 'landscape' | 'portrait' | undefined
|
|
11
|
+
/**
|
|
12
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultviewport
|
|
13
|
+
*/
|
|
14
|
+
defaultViewport?: string | undefined
|
|
15
|
+
/**
|
|
16
|
+
* Disables the viewport parameter.
|
|
17
|
+
* @deprecated Use `disabled` instead.
|
|
18
|
+
*/
|
|
19
|
+
disable?: boolean | undefined
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Viewport {
|
|
24
|
+
name: string
|
|
25
|
+
styles: {
|
|
26
|
+
width: string
|
|
27
|
+
height: string
|
|
28
|
+
}
|
|
29
|
+
type: 'mobile' | 'tablet' | 'desktop'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ViewportParamV9 {
|
|
33
|
+
viewport: {
|
|
34
|
+
/**
|
|
35
|
+
* @see https://storybook.js.org/docs/essentials/viewport#viewports
|
|
36
|
+
*/
|
|
37
|
+
options?: Record<string, Viewport> | undefined
|
|
38
|
+
/**
|
|
39
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultviewport
|
|
40
|
+
*/
|
|
41
|
+
defaultViewport?: string | undefined
|
|
42
|
+
/**
|
|
43
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultorientation
|
|
44
|
+
*/
|
|
45
|
+
defaultOrientation?: 'landscape' | 'portrait' | undefined
|
|
46
|
+
/**
|
|
47
|
+
* @see https://storybook.js.org/docs/essentials/viewport#disable
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean | undefined
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function defineViewportParam(viewport: ViewportParam['viewport'] | ViewportParamV9['viewport']): ViewportParam {
|
|
54
|
+
return { viewport }
|
|
55
|
+
}
|