@repobuddy/storybook 0.1.0 → 0.3.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/decorators/show_doc_source.d.ts +2 -0
- package/esm/decorators/show_doc_source.js +10 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -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_actions_param.d.ts +2 -0
- package/esm/parameters/define_backgrounds_param.d.ts +39 -0
- package/esm/parameters/define_backgrounds_param.js +3 -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_parameters.d.ts +2 -2
- package/esm/parameters/define_story_sort.d.ts +1 -0
- package/esm/parameters/define_test_param.d.ts +2 -0
- package/esm/parameters/define_viewport_param.d.ts +51 -0
- package/esm/parameters/define_viewport_param.js +3 -0
- package/package.json +7 -1
- package/readme.md +23 -9
- package/src/decorators/show_doc_source.tsx +21 -0
- package/src/index.ts +4 -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/overview.mdx +7 -0
- package/src/parameters/define_actions_param.ts +1 -0
- package/src/parameters/define_backgrounds_param.ts +48 -0
- package/src/parameters/define_docs_param.ts +206 -0
- package/src/parameters/define_parameters.ts +5 -1
- package/src/parameters/define_story_sort.ts +1 -0
- package/src/parameters/define_test_param.ts +1 -0
- package/src/parameters/define_viewport_param.ts +58 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function showDocSource() {
|
|
3
|
+
return (Story, { parameters }) => {
|
|
4
|
+
return (_jsxs("section", { style: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
gap: '1rem'
|
|
8
|
+
}, children: [_jsx("pre", { children: parameters.docs?.source?.code }), _jsx(Story, {})] }));
|
|
9
|
+
};
|
|
10
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export * from './decorators/show_doc_source.tsx';
|
|
1
2
|
export * from './parameters/define_actions_param.ts';
|
|
3
|
+
export * from './parameters/define_backgrounds_param.ts';
|
|
4
|
+
export * from './parameters/define_docs_param.ts';
|
|
2
5
|
export * from './parameters/define_layout_param.ts';
|
|
3
6
|
export * from './parameters/define_parameters.ts';
|
|
4
7
|
export * from './parameters/define_story_sort.ts';
|
|
5
8
|
export * from './parameters/define_test_param.ts';
|
|
9
|
+
export * from './parameters/define_viewport_param.ts';
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export * from "./decorators/show_doc_source.js";
|
|
1
2
|
export * from "./parameters/define_actions_param.js";
|
|
3
|
+
export * from "./parameters/define_backgrounds_param.js";
|
|
4
|
+
export * from "./parameters/define_docs_param.js";
|
|
2
5
|
export * from "./parameters/define_layout_param.js";
|
|
3
6
|
export * from "./parameters/define_parameters.js";
|
|
4
7
|
export * from "./parameters/define_story_sort.js";
|
|
5
8
|
export * from "./parameters/define_test_param.js";
|
|
9
|
+
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 logo to display in the brand title.
|
|
9
|
+
* It can be a simple string or raw HTML (e.g. `<svg>`).
|
|
10
|
+
*/
|
|
11
|
+
logo?: 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.logo - Optional logo 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
|
+
* logo: '<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.logo - Optional logo 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
|
+
* logo: '<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.logo ?? ''}
|
|
26
|
+
${options.title}
|
|
27
|
+
</span>`;
|
|
28
|
+
}
|
package/esm/manager.d.ts
CHANGED
package/esm/manager.js
CHANGED
|
@@ -3,6 +3,7 @@ export interface ActionsParam {
|
|
|
3
3
|
argTypesRegex?: string | undefined;
|
|
4
4
|
disable?: boolean | undefined;
|
|
5
5
|
handles?: string[] | undefined;
|
|
6
|
+
[k: string]: unknown;
|
|
6
7
|
};
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
@@ -15,6 +16,7 @@ export interface ActionsParam {
|
|
|
15
16
|
*/
|
|
16
17
|
export declare function defineActionsParam(actions: ActionsParam['actions']): {
|
|
17
18
|
actions: {
|
|
19
|
+
[k: string]: unknown;
|
|
18
20
|
argTypesRegex?: string | undefined;
|
|
19
21
|
disable?: boolean | undefined;
|
|
20
22
|
handles?: string[] | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface BackgroundsParam {
|
|
2
|
+
backgrounds: {
|
|
3
|
+
default?: string | undefined;
|
|
4
|
+
values?: Array<{
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}>;
|
|
8
|
+
disable?: boolean | undefined;
|
|
9
|
+
grid?: {
|
|
10
|
+
cellAmount?: number | undefined;
|
|
11
|
+
cellSize?: number | undefined;
|
|
12
|
+
disable?: boolean | undefined;
|
|
13
|
+
offsetX?: number | undefined;
|
|
14
|
+
offsetY?: number | undefined;
|
|
15
|
+
opacity?: number | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface GlobalApiBackgroundsParam {
|
|
21
|
+
backgrounds: {
|
|
22
|
+
default?: string | undefined;
|
|
23
|
+
options?: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}>;
|
|
27
|
+
disabled?: boolean | undefined;
|
|
28
|
+
grid?: {
|
|
29
|
+
cellAmount?: number | undefined;
|
|
30
|
+
cellSize?: number | undefined;
|
|
31
|
+
disable?: boolean | undefined;
|
|
32
|
+
offsetX?: number | undefined;
|
|
33
|
+
offsetY?: number | undefined;
|
|
34
|
+
opacity?: number | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
[k: string]: unknown;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export declare const defineBackgroundsParam: (backgrounds: BackgroundsParam["backgrounds"] | GlobalApiBackgroundsParam["backgrounds"]) => BackgroundsParam;
|
|
@@ -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'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { BackgroundsParam, GlobalApiBackgroundsParam } from './define_backgrounds_param.ts';
|
|
1
2
|
import type { LayoutParam } from './define_layout_param.ts';
|
|
2
3
|
import type { StorySortParam } from './define_story_sort.ts';
|
|
3
4
|
import type { TestParam } from './define_test_param.ts';
|
|
4
|
-
export
|
|
5
|
-
}
|
|
5
|
+
export type StorybookBuiltInParams = Partial<LayoutParam> & Partial<StorySortParam> & Partial<TestParam> & Partial<BackgroundsParam | GlobalApiBackgroundsParam>;
|
|
6
6
|
export declare function defineParameters<P extends Record<string, any>>(parameters: P & StorybookBuiltInParams): P & StorybookBuiltInParams;
|
|
@@ -4,6 +4,7 @@ export interface TestParam {
|
|
|
4
4
|
mockReset?: boolean | undefined;
|
|
5
5
|
restoreMocks?: boolean | undefined;
|
|
6
6
|
dangerouslyIgnoreUnhandledErrors?: boolean | undefined;
|
|
7
|
+
[k: string]: unknown;
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
@@ -24,6 +25,7 @@ export interface TestParam {
|
|
|
24
25
|
*/
|
|
25
26
|
export declare function defineTestParam(test: TestParam['test']): {
|
|
26
27
|
test: {
|
|
28
|
+
[k: string]: unknown;
|
|
27
29
|
clearMocks?: boolean | undefined;
|
|
28
30
|
mockReset?: boolean | undefined;
|
|
29
31
|
restoreMocks?: boolean | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
[k: string]: unknown;
|
|
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
|
+
export interface GlobalApiViewportParam {
|
|
32
|
+
viewport: {
|
|
33
|
+
/**
|
|
34
|
+
* @see https://storybook.js.org/docs/essentials/viewport#viewports
|
|
35
|
+
*/
|
|
36
|
+
options?: Record<string, Viewport> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultviewport
|
|
39
|
+
*/
|
|
40
|
+
defaultViewport?: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultorientation
|
|
43
|
+
*/
|
|
44
|
+
defaultOrientation?: 'landscape' | 'portrait' | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* @see https://storybook.js.org/docs/essentials/viewport#disable
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean | undefined;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare function defineViewportParam(viewport: ViewportParam['viewport'] | GlobalApiViewportParam['viewport']): ViewportParam;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repobuddy/storybook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Storybook repo buddy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -38,14 +38,20 @@
|
|
|
38
38
|
"@storybook/react-vite": "^8.6.12",
|
|
39
39
|
"@storybook/test": "^8.6.12",
|
|
40
40
|
"@storybook/theming": "^8.6.12",
|
|
41
|
+
"@tailwindcss/cli": "^4.1.5",
|
|
42
|
+
"@tailwindcss/vite": "^4.1.5",
|
|
41
43
|
"@vitest/browser": "^3.1.2",
|
|
42
44
|
"@vitest/coverage-v8": "^3.1.2",
|
|
45
|
+
"dedent": "^1.6.0",
|
|
43
46
|
"react": "^19.1.0",
|
|
44
47
|
"react-dom": "^19.1.0",
|
|
45
48
|
"rimraf": "^6.0.1",
|
|
46
49
|
"storybook": "^8.6.12",
|
|
47
50
|
"storybook-addon-tag-badges": "^1.4.0",
|
|
48
51
|
"storybook-addon-vis": "^0.19.4",
|
|
52
|
+
"storybook-dark-mode": "^4.0.2",
|
|
53
|
+
"tailwindcss": "^4.1.5",
|
|
54
|
+
"vite": "^6.3.4",
|
|
49
55
|
"vitest": "^3.1.2"
|
|
50
56
|
},
|
|
51
57
|
"scripts": {
|
package/readme.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @repobuddy/storybook
|
|
2
2
|
|
|
3
|
-
Your
|
|
3
|
+
Your repository buddy for Storybook.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```sh
|
|
8
8
|
pnpm add -D @repobuddy/storybook
|
|
9
9
|
```
|
|
10
10
|
|
|
@@ -12,9 +12,10 @@ pnpm add -D @repobuddy/storybook
|
|
|
12
12
|
|
|
13
13
|
### Typed Parameters
|
|
14
14
|
|
|
15
|
-
Storybook supports some built-in parameters,
|
|
15
|
+
Storybook supports some built-in parameters,
|
|
16
|
+
but the `parameters` props in the `StoryObj` type is typed as `Record<string, any>`.
|
|
16
17
|
|
|
17
|
-
[`@repobuddy/storybook`] adds these types as well as their corresponding define-functions so that you can use them in your stories.
|
|
18
|
+
[`@repobuddy/storybook`][`@repobuddy/storybook`] adds these types as well as their corresponding define-functions so that you can use them in your stories.
|
|
18
19
|
|
|
19
20
|
For example:
|
|
20
21
|
|
|
@@ -43,12 +44,25 @@ export const MyStory: StoryObj = {
|
|
|
43
44
|
}
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
###
|
|
47
|
+
### Brand Title
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
[`@repobuddy/storybook`][`@repobuddy/storybook`] also provides a `brandTitle` parameter that allows you to set the brand title of your Storybook.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
```ts
|
|
52
|
+
import { brandTitle } from '@repobuddy/storybook/manager'
|
|
53
|
+
|
|
54
|
+
addons.setConfig({
|
|
55
|
+
brandTitle: brandTitle({
|
|
56
|
+
title:'My Brand',
|
|
57
|
+
logo: `<svg.../>`
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Tag Badges
|
|
63
|
+
|
|
64
|
+
If you use [`storybook-addon-tag-badges`][`storybook-addon-tag-badges`],
|
|
65
|
+
we provide a different set of badges that uses emojis:
|
|
52
66
|
|
|
53
67
|
- 🆕 New components/features
|
|
54
68
|
- 🅱️ Beta status
|
|
@@ -58,7 +72,7 @@ we provide a different set of badges that uses icons:
|
|
|
58
72
|
- 📋 To-do items
|
|
59
73
|
- 📝 Code-only stories
|
|
60
74
|
- 🧪 Unit tests
|
|
61
|
-
-
|
|
75
|
+
- 🔄 Integration tests
|
|
62
76
|
- Version indicators (unchanged)
|
|
63
77
|
|
|
64
78
|
To use them, add them to your `.storybook/manager.ts`:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Args, DecoratorFunction, Renderer } from 'storybook/internal/csf'
|
|
2
|
+
|
|
3
|
+
export function showDocSource<TRenderer extends Renderer = Renderer, TArgs = Args>(): DecoratorFunction<
|
|
4
|
+
TRenderer,
|
|
5
|
+
TArgs
|
|
6
|
+
> {
|
|
7
|
+
return (Story, { parameters }) => {
|
|
8
|
+
return (
|
|
9
|
+
<section
|
|
10
|
+
style={{
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
gap: '1rem'
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<pre>{parameters.docs?.source?.code}</pre>
|
|
17
|
+
<Story />
|
|
18
|
+
</section>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export * from './decorators/show_doc_source.tsx'
|
|
1
2
|
export * from './parameters/define_actions_param.ts'
|
|
3
|
+
export * from './parameters/define_backgrounds_param.ts'
|
|
4
|
+
export * from './parameters/define_docs_param.ts'
|
|
2
5
|
export * from './parameters/define_layout_param.ts'
|
|
3
6
|
export * from './parameters/define_parameters.ts'
|
|
4
7
|
export * from './parameters/define_story_sort.ts'
|
|
5
8
|
export * from './parameters/define_test_param.ts'
|
|
9
|
+
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 logo to display in the brand title.
|
|
9
|
+
* It can be a simple string or raw HTML (e.g. `<svg>`).
|
|
10
|
+
*/
|
|
11
|
+
logo?: 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.logo - Optional logo 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
|
+
* logo: '<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.logo ?? ''}
|
|
39
|
+
${options.title}
|
|
40
|
+
</span>`
|
|
41
|
+
}
|
package/src/manager.ts
CHANGED
package/src/overview.mdx
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface BackgroundsParam {
|
|
2
|
+
backgrounds: {
|
|
3
|
+
default?: string | undefined
|
|
4
|
+
values?: Array<{
|
|
5
|
+
name: string
|
|
6
|
+
value: string
|
|
7
|
+
}>
|
|
8
|
+
disable?: boolean | undefined
|
|
9
|
+
grid?:
|
|
10
|
+
| {
|
|
11
|
+
cellAmount?: number | undefined
|
|
12
|
+
cellSize?: number | undefined
|
|
13
|
+
disable?: boolean | undefined
|
|
14
|
+
offsetX?: number | undefined
|
|
15
|
+
offsetY?: number | undefined
|
|
16
|
+
opacity?: number | undefined
|
|
17
|
+
}
|
|
18
|
+
| undefined
|
|
19
|
+
[k: string]: unknown
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export interface GlobalApiBackgroundsParam {
|
|
23
|
+
backgrounds: {
|
|
24
|
+
default?: string | undefined
|
|
25
|
+
options?: Array<{
|
|
26
|
+
name: string
|
|
27
|
+
value: string
|
|
28
|
+
}>
|
|
29
|
+
disabled?: boolean | undefined
|
|
30
|
+
grid?:
|
|
31
|
+
| {
|
|
32
|
+
cellAmount?: number | undefined
|
|
33
|
+
cellSize?: number | undefined
|
|
34
|
+
disable?: boolean | undefined
|
|
35
|
+
offsetX?: number | undefined
|
|
36
|
+
offsetY?: number | undefined
|
|
37
|
+
opacity?: number | undefined
|
|
38
|
+
}
|
|
39
|
+
| undefined
|
|
40
|
+
[k: string]: unknown
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const defineBackgroundsParam = (
|
|
45
|
+
backgrounds: BackgroundsParam['backgrounds'] | GlobalApiBackgroundsParam['backgrounds']
|
|
46
|
+
): BackgroundsParam => ({
|
|
47
|
+
backgrounds
|
|
48
|
+
})
|
|
@@ -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
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { BackgroundsParam, GlobalApiBackgroundsParam } from './define_backgrounds_param.ts'
|
|
1
2
|
import type { LayoutParam } from './define_layout_param.ts'
|
|
2
3
|
import type { StorySortParam } from './define_story_sort.ts'
|
|
3
4
|
import type { TestParam } from './define_test_param.ts'
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
+
export type StorybookBuiltInParams = Partial<LayoutParam> &
|
|
7
|
+
Partial<StorySortParam> &
|
|
8
|
+
Partial<TestParam> &
|
|
9
|
+
Partial<BackgroundsParam | GlobalApiBackgroundsParam>
|
|
6
10
|
|
|
7
11
|
export function defineParameters<P extends Record<string, any>>(parameters: P & StorybookBuiltInParams) {
|
|
8
12
|
return parameters
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
[k: string]: unknown
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Viewport {
|
|
25
|
+
name: string
|
|
26
|
+
styles: {
|
|
27
|
+
width: string
|
|
28
|
+
height: string
|
|
29
|
+
}
|
|
30
|
+
type: 'mobile' | 'tablet' | 'desktop'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface GlobalApiViewportParam {
|
|
34
|
+
viewport: {
|
|
35
|
+
/**
|
|
36
|
+
* @see https://storybook.js.org/docs/essentials/viewport#viewports
|
|
37
|
+
*/
|
|
38
|
+
options?: Record<string, Viewport> | undefined
|
|
39
|
+
/**
|
|
40
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultviewport
|
|
41
|
+
*/
|
|
42
|
+
defaultViewport?: string | undefined
|
|
43
|
+
/**
|
|
44
|
+
* @see https://storybook.js.org/docs/essentials/viewport#defaultorientation
|
|
45
|
+
*/
|
|
46
|
+
defaultOrientation?: 'landscape' | 'portrait' | undefined
|
|
47
|
+
/**
|
|
48
|
+
* @see https://storybook.js.org/docs/essentials/viewport#disable
|
|
49
|
+
*/
|
|
50
|
+
disabled?: boolean | undefined
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function defineViewportParam(
|
|
55
|
+
viewport: ViewportParam['viewport'] | GlobalApiViewportParam['viewport']
|
|
56
|
+
): ViewportParam {
|
|
57
|
+
return { viewport }
|
|
58
|
+
}
|